summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes.ljungberg@gmail.com>2020-10-17 21:54:36 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-19 08:36:07 +0200
commitc7c7615d005b1454e6958a4ee35a3a976d12319e (patch)
tree83208c5b312ddab83d3739ad1e1e1b5db79786b3 /tests
parent4e4db426c5b0a18d1fd4dac6fc1342ab7762b288 (diff)
Fixed #32116 -- Fixed QuerySet.order_by() crash on EmptyQuerySet with union() on a single non-empty ordered queryset.
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/test_qs_combinators.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
index 5a10196da5..073f104a22 100644
--- a/tests/queries/test_qs_combinators.py
+++ b/tests/queries/test_qs_combinators.py
@@ -106,6 +106,11 @@ class QuerySetSetOperationTests(TestCase):
self.assertEqual(len(qs2.union(qs2)), 0)
self.assertEqual(len(qs3.union(qs3)), 0)
+ def test_empty_qs_union_with_ordered_qs(self):
+ qs1 = Number.objects.all().order_by('num')
+ qs2 = Number.objects.none().union(qs1).order_by('num')
+ self.assertEqual(list(qs1), list(qs2))
+
def test_limits(self):
qs1 = Number.objects.all()
qs2 = Number.objects.all()