1
0
mirror of https://github.com/django/django.git synced 2024-12-24 10:05:46 +00:00

Fixed a couple of tests migrated to unit tests in r14279 so they actually and correctly exercise the functionality under test.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2010-12-18 23:03:23 +00:00
parent bc27405fc5
commit a360240c56

View File

@ -27,6 +27,12 @@ class BaseQuerysetTest(TestCase):
except Exception, e: except Exception, e:
self.assertEqual(msg, str(e)) self.assertEqual(msg, str(e))
self.assertTrue(isinstance(e, exc), "Expected %s, got %s" % (exc, type(e))) self.assertTrue(isinstance(e, exc), "Expected %s, got %s" % (exc, type(e)))
else:
if hasattr(exc, '__name__'):
excName = exc.__name__
else:
excName = str(exc)
raise AssertionError, "%s not raised" % excName
class Queries1Tests(BaseQuerysetTest): class Queries1Tests(BaseQuerysetTest):
@ -1528,12 +1534,12 @@ class ConditionalTests(BaseQuerysetTest):
self.assertRaisesMessage( self.assertRaisesMessage(
FieldError, FieldError,
'Infinite loop caused by ordering.', 'Infinite loop caused by ordering.',
LoopX.objects.all lambda: list(LoopX.objects.all()) # Force queryset evaluation with list()
) )
self.assertRaisesMessage( self.assertRaisesMessage(
FieldError, FieldError,
'Infinite loop caused by ordering.', 'Infinite loop caused by ordering.',
LoopZ.objects.all lambda: list(LoopZ.objects.all()) # Force queryset evaluation with list()
) )
# Note that this doesn't cause an infinite loop, since the default # Note that this doesn't cause an infinite loop, since the default