From a360240c56a47752f65146777c0f1d9055a86bc8 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sat, 18 Dec 2010 23:03:23 +0000 Subject: [PATCH] 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 --- tests/regressiontests/queries/tests.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py index ab75eb62ca..c5fa18e9d6 100644 --- a/tests/regressiontests/queries/tests.py +++ b/tests/regressiontests/queries/tests.py @@ -27,6 +27,12 @@ class BaseQuerysetTest(TestCase): except Exception, e: self.assertEqual(msg, str(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): @@ -1528,12 +1534,12 @@ class ConditionalTests(BaseQuerysetTest): self.assertRaisesMessage( FieldError, 'Infinite loop caused by ordering.', - LoopX.objects.all + lambda: list(LoopX.objects.all()) # Force queryset evaluation with list() ) self.assertRaisesMessage( FieldError, '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