diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-02-05 07:00:57 -0800 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-02-05 10:00:57 -0500 |
commit | f0658ff818140f9d2a66866a937408901722e1f8 (patch) | |
tree | 96227cb45904a0c32c3ad33f797fb69f8833e3a5 /tests/prefetch_related | |
parent | da3df5b878d96ef37dcff1377ccbd097b80776d7 (diff) | |
download | django-f0658ff818140f9d2a66866a937408901722e1f8.tar.gz |
Made prefetch_related tests use assertCountEqual() for unordered sequences.
Diffstat (limited to 'tests/prefetch_related')
-rw-r--r-- | tests/prefetch_related/test_prefetch_related_objects.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/prefetch_related/test_prefetch_related_objects.py b/tests/prefetch_related/test_prefetch_related_objects.py index 6a53d33f6b..c0aa433b91 100644 --- a/tests/prefetch_related/test_prefetch_related_objects.py +++ b/tests/prefetch_related/test_prefetch_related_objects.py @@ -43,7 +43,7 @@ class PrefetchRelatedObjectsTests(TestCase): prefetch_related_objects([book1], 'authors') with self.assertNumQueries(0): - self.assertEqual(set(book1.authors.all()), {self.author1, self.author2, self.author3}) + self.assertCountEqual(book1.authors.all(), [self.author1, self.author2, self.author3]) def test_m2m_reverse(self): author1 = Author.objects.get(id=self.author1.id) @@ -51,7 +51,7 @@ class PrefetchRelatedObjectsTests(TestCase): prefetch_related_objects([author1], 'books') with self.assertNumQueries(0): - self.assertEqual(set(author1.books.all()), {self.book1, self.book2}) + self.assertCountEqual(author1.books.all(), [self.book1, self.book2]) def test_foreignkey_forward(self): authors = list(Author.objects.all()) @@ -95,7 +95,7 @@ class PrefetchRelatedObjectsTests(TestCase): prefetch_related_objects([book1], Prefetch('authors')) with self.assertNumQueries(0): - self.assertEqual(set(book1.authors.all()), {self.author1, self.author2, self.author3}) + self.assertCountEqual(book1.authors.all(), [self.author1, self.author2, self.author3]) def test_prefetch_object_to_attr(self): book1 = Book.objects.get(id=self.book1.id) @@ -103,7 +103,7 @@ class PrefetchRelatedObjectsTests(TestCase): prefetch_related_objects([book1], Prefetch('authors', to_attr='the_authors')) with self.assertNumQueries(0): - self.assertEqual(set(book1.the_authors), {self.author1, self.author2, self.author3}) + self.assertCountEqual(book1.the_authors, [self.author1, self.author2, self.author3]) def test_prefetch_queryset(self): book1 = Book.objects.get(id=self.book1.id) @@ -114,4 +114,4 @@ class PrefetchRelatedObjectsTests(TestCase): ) with self.assertNumQueries(0): - self.assertEqual(set(book1.authors.all()), {self.author1, self.author2}) + self.assertCountEqual(book1.authors.all(), [self.author1, self.author2]) |