[1.8.x] Refs #24060 -- Added a test demonstrating reverse order isn't mutable
Backport of f218a2ff45
from master
This commit is contained in:
parent
7cc1b4710e
commit
405351ba2f
|
@ -137,6 +137,28 @@ class OrderingTests(TestCase):
|
|||
attrgetter("headline")
|
||||
)
|
||||
|
||||
def test_reverse_ordering_pure(self):
|
||||
qs1 = Article.objects.order_by(F('headline').asc())
|
||||
qs2 = qs1.reverse()
|
||||
self.assertQuerysetEqual(
|
||||
qs1, [
|
||||
"Article 1",
|
||||
"Article 2",
|
||||
"Article 3",
|
||||
"Article 4",
|
||||
],
|
||||
attrgetter("headline")
|
||||
)
|
||||
self.assertQuerysetEqual(
|
||||
qs2, [
|
||||
"Article 4",
|
||||
"Article 3",
|
||||
"Article 2",
|
||||
"Article 1",
|
||||
],
|
||||
attrgetter("headline")
|
||||
)
|
||||
|
||||
def test_extra_ordering(self):
|
||||
"""
|
||||
Ordering can be based on fields included from an 'extra' clause
|
||||
|
|
Loading…
Reference in New Issue