diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-10-18 18:29:52 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-11-06 09:24:50 +0100 |
| commit | 3f7b3275627385f8f7531fca01cdda50d4ec6b6e (patch) | |
| tree | fb082d40e73f6c877911eab92229ac21cdfaa5bc /tests/custom_columns | |
| parent | 13b6fff11703a694e155b84d41d02822bbc0aaa0 (diff) | |
Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.
This also replaces assertQuerysetEqual() to
assertSequenceEqual()/assertCountEqual() where appropriate.
Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'tests/custom_columns')
| -rw-r--r-- | tests/custom_columns/tests.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/custom_columns/tests.py b/tests/custom_columns/tests.py index 874b024050..b389a7e02f 100644 --- a/tests/custom_columns/tests.py +++ b/tests/custom_columns/tests.py @@ -78,15 +78,15 @@ class CustomColumnsTests(TestCase): ) def test_author_querying(self): - self.assertQuerysetEqual( + self.assertSequenceEqual( Author.objects.all().order_by('last_name'), - ['<Author: Peter Jones>', '<Author: John Smith>'] + [self.a2, self.a1], ) def test_author_filtering(self): - self.assertQuerysetEqual( + self.assertSequenceEqual( Author.objects.filter(first_name__exact='John'), - ['<Author: John Smith>'] + [self.a1], ) def test_author_get(self): @@ -111,15 +111,12 @@ class CustomColumnsTests(TestCase): getattr(a, 'last') def test_m2m_table(self): - self.assertQuerysetEqual( + self.assertSequenceEqual( self.article.authors.all().order_by('last_name'), - ['<Author: Peter Jones>', '<Author: John Smith>'] + [self.a2, self.a1], ) - self.assertQuerysetEqual( - self.a1.article_set.all(), - ['<Article: Django lets you build Web apps easily>'] - ) - self.assertQuerysetEqual( + self.assertSequenceEqual(self.a1.article_set.all(), [self.article]) + self.assertSequenceEqual( self.article.authors.filter(last_name='Jones'), - ['<Author: Peter Jones>'] + [self.a2], ) |
