Fixed a form test from [12211] that didn't clean up after itself. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2010-01-16 22:45:39 +00:00
parent 2e9518bb39
commit 5bc344ceca
1 changed files with 2 additions and 1 deletions

View File

@ -61,10 +61,11 @@ class TestTicket12510(TestCase):
settings.DEBUG = self.old_debug settings.DEBUG = self.old_debug
def test_choices_not_fetched_when_not_rendering(self): def test_choices_not_fetched_when_not_rendering(self):
initial_queries = len(connection.queries)
field = django_forms.ModelChoiceField(Group.objects.order_by('-name')) field = django_forms.ModelChoiceField(Group.objects.order_by('-name'))
self.assertEqual('a', field.clean(self.groups[0].pk).name) self.assertEqual('a', field.clean(self.groups[0].pk).name)
# only one query is required to pull the model from DB # only one query is required to pull the model from DB
self.assertEqual(1, len(connection.queries)) self.assertEqual(initial_queries+1, len(connection.queries))
__test__ = {'API_TESTS': """ __test__ = {'API_TESTS': """