diff options
author | Simon Charette <charette.s@gmail.com> | 2021-05-04 17:49:46 -0400 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-05-05 08:44:37 +0200 |
commit | 364098fdac597d2293d844d81ab523c22ca5a361 (patch) | |
tree | e044f0643cd4565e95017400c4b3feedf2d8f948 /tests | |
parent | df801dde3344549bcd8db2abe6b0e4ac23f278ca (diff) | |
download | django-364098fdac597d2293d844d81ab523c22ca5a361.tar.gz |
[3.2.x] Fixed #32714 -- Prevented recreation of migration for Meta.ordering with OrderBy expressions.
Regression in c8b659430556dca0b2fe27cf2ea0f8290dbafecd.
Thanks Kevin Marsh for the report.
Backport of 96f55ccf798c7592a1203f798a4dffaf173a9263 from main
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expressions/tests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 9a34242de7..bea7633a49 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -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)), + ) |