mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[3.2.x] Fixed #32714 -- Prevented recreation of migration for Meta.ordering with OrderBy expressions.
Regression inc8b6594305. Thanks Kevin Marsh for the report. Backport of96f55ccf79from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
df801dde33
commit
364098fdac
@@ -1947,3 +1947,25 @@ class ExpressionWrapperTests(SimpleTestCase):
|
||||
group_by_cols = expr.get_group_by_cols(alias=None)
|
||||
self.assertEqual(group_by_cols, [expr.expression])
|
||||
self.assertEqual(group_by_cols[0].output_field, expr.output_field)
|
||||
|
||||
|
||||
class OrderByTests(SimpleTestCase):
|
||||
def test_equal(self):
|
||||
self.assertEqual(
|
||||
OrderBy(F('field'), nulls_last=True),
|
||||
OrderBy(F('field'), nulls_last=True),
|
||||
)
|
||||
self.assertNotEqual(
|
||||
OrderBy(F('field'), nulls_last=True),
|
||||
OrderBy(F('field'), nulls_last=False),
|
||||
)
|
||||
|
||||
def test_hash(self):
|
||||
self.assertEqual(
|
||||
hash(OrderBy(F('field'), nulls_last=True)),
|
||||
hash(OrderBy(F('field'), nulls_last=True)),
|
||||
)
|
||||
self.assertNotEqual(
|
||||
hash(OrderBy(F('field'), nulls_last=True)),
|
||||
hash(OrderBy(F('field'), nulls_last=False)),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user