Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a couple of tests migrated to unit tests in r14279 so they actu…

…ally and correctly exercise the functionality under test.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a360240c56a47752f65146777c0f1d9055a86bc8 1 parent bc27405
Ramiro Morales authored

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  tests/regressiontests/queries/tests.py
10  tests/regressiontests/queries/tests.py
@@ -27,6 +27,12 @@ def assertRaisesMessage(self, exc, msg, func, *args, **kwargs):
27 27
         except Exception, e:
28 28
             self.assertEqual(msg, str(e))
29 29
             self.assertTrue(isinstance(e, exc), "Expected %s, got %s" % (exc, type(e)))
  30
+        else:
  31
+            if hasattr(exc, '__name__'):
  32
+                excName = exc.__name__
  33
+            else:
  34
+                excName = str(exc)
  35
+            raise AssertionError, "%s not raised" % excName
30 36
 
31 37
 
32 38
 class Queries1Tests(BaseQuerysetTest):
@@ -1528,12 +1534,12 @@ def test_infinite_loop(self):
1528 1534
         self.assertRaisesMessage(
1529 1535
             FieldError,
1530 1536
             'Infinite loop caused by ordering.',
1531  
-            LoopX.objects.all
  1537
+            lambda: list(LoopX.objects.all()) # Force queryset evaluation with list()
1532 1538
         )
1533 1539
         self.assertRaisesMessage(
1534 1540
             FieldError,
1535 1541
             'Infinite loop caused by ordering.',
1536  
-            LoopZ.objects.all
  1542
+            lambda: list(LoopZ.objects.all()) # Force queryset evaluation with list()
1537 1543
         )
1538 1544
 
1539 1545
         # Note that this doesn't cause an infinite loop, since the default

0 notes on commit a360240

Please sign in to comment.
Something went wrong with that request. Please try again.