diff options
| author | Astral <AmrAnwar@users.noreply.github.com> | 2018-03-20 04:05:43 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-19 21:05:43 -0400 |
| commit | a0c03c62a8ac586e5be5b21393c925afa581efaf (patch) | |
| tree | aeb02cac3280557d39ccd20ab2ec18345ba848e9 /tests | |
| parent | cede5111bbeea1f02a7d35941a4264c7ff95df0a (diff) | |
Fixed #29229 -- Fixed column mismatch crash when combining two annotated values_list() querysets with union(), difference(), or intersection().
Regression in 7316720603821ebb64dfe8fa592ba6edcef5f3e.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/queries/test_qs_combinators.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py index 8026bf227d..e2ec18c034 100644 --- a/tests/queries/test_qs_combinators.py +++ b/tests/queries/test_qs_combinators.py @@ -119,6 +119,17 @@ class QuerySetSetOperationTests(TestCase): reserved_name = qs1.union(qs1).values_list('name', 'order', 'id').get() self.assertEqual(reserved_name[:2], ('a', 2)) + def test_union_with_two_annotated_values_list(self): + qs1 = Number.objects.filter(num=1).annotate( + count=Value(0, IntegerField()), + ).values_list('num', 'count') + qs2 = Number.objects.filter(num=2).values('pk').annotate( + count=F('num'), + ).annotate( + num=Value(1, IntegerField()), + ).values_list('num', 'count') + self.assertCountEqual(qs1.union(qs2), [(1, 0), (2, 1)]) + def test_count_union(self): qs1 = Number.objects.filter(num__lte=1).values('num') qs2 = Number.objects.filter(num__gte=2, num__lte=3).values('num') |
