1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #36388 -- Made QuerySet.union() return self when called with no arguments.

Regression in 9cb8baa0c4.
Thank you to Antoine Humeau for the report and Simon Charette for the review.
This commit is contained in:
Colleen Dunlap
2025-05-15 15:41:59 -04:00
committed by Sarah Boyce
parent 1ba5fe19ca
commit 802baf5da5
4 changed files with 13 additions and 0 deletions

View File

@@ -88,6 +88,13 @@ class QuerySetSetOperationTests(TestCase):
qs3 = qs1.union(qs2)
self.assertNumbersEqual(qs3[:1], [0])
def test_union_empty_slice(self):
qs = Number.objects.union()
self.assertNumbersEqual(qs[:1], [0])
qs = Number.objects.union(all=True)
self.assertNumbersEqual(qs[:1], [0])
self.assertNumbersEqual(qs.order_by("num")[0:], list(range(0, 10)))
def test_union_all_none_slice(self):
qs = Number.objects.filter(id__in=[])
with self.assertNumQueries(0):