Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Altered test introduced in f19a366 for the sake of readability. refs …

…#14786
  • Loading branch information...
commit 36bbe3b7c52d459ed4862bbad1b44541a58cda00 1 parent 50d25a9
@charettes charettes authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 tests/model_fields/tests.py
View
13 tests/model_fields/tests.py
@@ -672,12 +672,17 @@ def test_14786(self):
Regression test for #14786 -- Test that field values are not prepared
twice in get_db_prep_lookup().
"""
- prepare_count = [0]
class NoopField(models.TextField):
+ def __init__(self, *args, **kwargs):
+ self.prep_value_count = 0
+ super(NoopField, self).__init__(*args, **kwargs)
+
def get_prep_value(self, value):
- prepare_count[0] += 1
+ self.prep_value_count += 1
return super(NoopField, self).get_prep_value(value)
field = NoopField()
- field.get_db_prep_lookup('exact', 'TEST', connection=connection, prepared=False)
- self.assertEqual(prepare_count[0], 1)
+ field.get_db_prep_lookup(
+ 'exact', 'TEST', connection=connection, prepared=False
+ )
+ self.assertEqual(field.prep_value_count, 1)
Please sign in to comment.
Something went wrong with that request. Please try again.