Relaxed some query ordering assertions in tests.

It accounts for differences seen on cockroachdb.
This commit is contained in:
Tim Graham 2019-11-18 06:32:37 -05:00 committed by Mariusz Felisiak
parent 5e2839f320
commit 9100c664db
3 changed files with 3 additions and 3 deletions

View File

@ -440,7 +440,7 @@ class AggregateTestCase(TestCase):
def test_fkey_aggregate(self): def test_fkey_aggregate(self):
explicit = list(Author.objects.annotate(Count('book__id'))) explicit = list(Author.objects.annotate(Count('book__id')))
implicit = list(Author.objects.annotate(Count('book'))) implicit = list(Author.objects.annotate(Count('book')))
self.assertEqual(explicit, implicit) self.assertCountEqual(explicit, implicit)
def test_annotate_ordering(self): def test_annotate_ordering(self):
books = Book.objects.values('rating').annotate(oldest=Max('authors__age')).order_by('oldest', 'rating') books = Book.objects.values('rating').annotate(oldest=Max('authors__age')).order_by('oldest', 'rating')

View File

@ -209,7 +209,7 @@ class NonAggregateAnnotationTestCase(TestCase):
lengths = Employee.objects.annotate( lengths = Employee.objects.annotate(
name_len=Length('first_name'), name_len=Length('first_name'),
).distinct('name_len').values_list('name_len', flat=True) ).distinct('name_len').values_list('name_len', flat=True)
self.assertSequenceEqual(lengths, [3, 7, 8]) self.assertCountEqual(lengths, [3, 7, 8])
def test_filter_annotation(self): def test_filter_annotation(self):
books = Book.objects.annotate( books = Book.objects.annotate(

View File

@ -699,7 +699,7 @@ class WindowFunctionTests(TestCase):
highest=Window(FirstValue('id'), partition_by=F('department'), order_by=F('salary').desc()) highest=Window(FirstValue('id'), partition_by=F('department'), order_by=F('salary').desc())
).values('highest') ).values('highest')
highest_salary = Employee.objects.filter(pk__in=subquery_qs) highest_salary = Employee.objects.filter(pk__in=subquery_qs)
self.assertSequenceEqual(highest_salary.values('department', 'salary'), [ self.assertCountEqual(highest_salary.values('department', 'salary'), [
{'department': 'Accounting', 'salary': 50000}, {'department': 'Accounting', 'salary': 50000},
{'department': 'Sales', 'salary': 55000}, {'department': 'Sales', 'salary': 55000},
{'department': 'Marketing', 'salary': 40000}, {'department': 'Marketing', 'salary': 40000},