mirror of
https://github.com/django/django.git
synced 2025-08-16 00:30:47 +00:00
Fixed #36388 -- Made QuerySet.union() return self when called with no arguments.
Some checks failed
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Some checks failed
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Regression in 9cb8baa0c4
.
Thank you to Antoine Humeau for the report and Simon Charette for the review.
This commit is contained in:
parent
1ba5fe19ca
commit
802baf5da5
4 changed files with 13 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue