mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Refs #33308 -- Added tests for queryset ordered by annotation with nulls_first/nulls_last.
This commit is contained in:
parent
eafe1468d2
commit
a6511bc233
@ -165,6 +165,12 @@ class OrderingTests(TestCase):
|
|||||||
),
|
),
|
||||||
[self.a3, self.a4, self.a1, self.a2],
|
[self.a3, self.a4, self.a1, self.a2],
|
||||||
)
|
)
|
||||||
|
self.assertQuerySetEqualReversible(
|
||||||
|
Article.objects.annotate(upper_name=Upper("author__name")).order_by(
|
||||||
|
F("upper_name").asc(nulls_last=True), "headline"
|
||||||
|
),
|
||||||
|
[self.a3, self.a4, self.a1, self.a2],
|
||||||
|
)
|
||||||
|
|
||||||
def test_order_by_nulls_first(self):
|
def test_order_by_nulls_first(self):
|
||||||
Article.objects.filter(headline="Article 3").update(author=self.author_1)
|
Article.objects.filter(headline="Article 3").update(author=self.author_1)
|
||||||
@ -190,6 +196,12 @@ class OrderingTests(TestCase):
|
|||||||
),
|
),
|
||||||
[self.a1, self.a2, self.a4, self.a3],
|
[self.a1, self.a2, self.a4, self.a3],
|
||||||
)
|
)
|
||||||
|
self.assertQuerySetEqualReversible(
|
||||||
|
Article.objects.annotate(upper_name=Upper("author__name")).order_by(
|
||||||
|
F("upper_name").desc(nulls_first=True), "headline"
|
||||||
|
),
|
||||||
|
[self.a1, self.a2, self.a4, self.a3],
|
||||||
|
)
|
||||||
|
|
||||||
def test_orders_nulls_first_on_filtered_subquery(self):
|
def test_orders_nulls_first_on_filtered_subquery(self):
|
||||||
Article.objects.filter(headline="Article 1").update(author=self.author_1)
|
Article.objects.filter(headline="Article 1").update(author=self.author_1)
|
||||||
|
Loading…
Reference in New Issue
Block a user