summaryrefslogtreecommitdiff
path: root/tests/modeltests/many_to_one
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2012-12-13 13:33:11 +0200
committerAnssi Kääriäinen <akaariai@gmail.com>2012-12-13 13:33:11 +0200
commit088d3bc2f84b6b68fee7e5de053b58049bd110e7 (patch)
treeecb350eeba16a0b05c131008a552a91f23644e95 /tests/modeltests/many_to_one
parent6ed6a18a033ba78de9418f5b56b80f8b3d3aaf11 (diff)
downloaddjango-088d3bc2f84b6b68fee7e5de053b58049bd110e7.tar.gz
Fixed #19462 -- Made assertQuerysetEqual detect undefined ordering
If there are more than one values to compare against and the qs isn't ordered then assertQuerysetEqual will raise a ValueError.
Diffstat (limited to 'tests/modeltests/many_to_one')
-rw-r--r--tests/modeltests/many_to_one/tests.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/modeltests/many_to_one/tests.py b/tests/modeltests/many_to_one/tests.py
index 4fb19dbc69..44ae689dd4 100644
--- a/tests/modeltests/many_to_one/tests.py
+++ b/tests/modeltests/many_to_one/tests.py
@@ -267,7 +267,9 @@ class ManyToOneTests(TestCase):
["<Reporter: John Smith>"])
self.assertQuerysetEqual(
Reporter.objects.filter(article__headline__startswith='T'),
- ["<Reporter: John Smith>", "<Reporter: John Smith>"])
+ ["<Reporter: John Smith>", "<Reporter: John Smith>"],
+ ordered=False
+ )
self.assertQuerysetEqual(
Reporter.objects.filter(article__headline__startswith='T').distinct(),
["<Reporter: John Smith>"])
@@ -285,7 +287,9 @@ class ManyToOneTests(TestCase):
"<Reporter: John Smith>",
"<Reporter: John Smith>",
"<Reporter: John Smith>",
- ])
+ ],
+ ordered=False
+ )
self.assertQuerysetEqual(
Reporter.objects.filter(article__reporter__first_name__startswith='John').distinct(),
["<Reporter: John Smith>"])