1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32714 -- Prevented recreation of migration for Meta.ordering with OrderBy expressions.

Regression in c8b6594305.

Thanks Kevin Marsh for the report.
This commit is contained in:
Simon Charette
2021-05-04 17:49:46 -04:00
committed by Mariusz Felisiak
parent f9f6bd63c9
commit 96f55ccf79
3 changed files with 26 additions and 3 deletions

View File

@@ -2000,3 +2000,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)),
)