Permalink
Browse files

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

…#14786
  • Loading branch information...
1 parent 50d25a9 commit 36bbe3b7c52d459ed4862bbad1b44541a58cda00 @charettes charettes committed Aug 29, 2013
Showing with 9 additions and 4 deletions.
  1. +9 −4 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)

0 comments on commit 36bbe3b

Please sign in to comment.