diff options
author | Matthew Wilkes <git@matthewwilkes.name> | 2017-06-18 16:53:40 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-02-10 19:08:55 -0500 |
commit | 2162f0983de0dfe2178531638ce7ea56f54dd4e7 (patch) | |
tree | bb1e859159200fa7ebeeaa02ec3908e1cf5d2655 /tests/postgres_tests/test_array.py | |
parent | bf26f66029bca94b007a2452679ac004598364a6 (diff) | |
download | django-2162f0983de0dfe2178531638ce7ea56f54dd4e7.tar.gz |
Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r-- | tests/postgres_tests/test_array.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 4776bda934..03ffa4d637 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -309,6 +309,22 @@ class TestQuerying(PostgreSQLTestCase): self.objs[2:3] ) + def test_order_by_slice(self): + more_objs = ( + NullableIntegerArrayModel.objects.create(field=[1, 637]), + NullableIntegerArrayModel.objects.create(field=[2, 1]), + NullableIntegerArrayModel.objects.create(field=[3, -98123]), + NullableIntegerArrayModel.objects.create(field=[4, 2]), + ) + self.assertSequenceEqual( + NullableIntegerArrayModel.objects.order_by('field__1'), + [ + more_objs[2], more_objs[1], more_objs[3], self.objs[2], + self.objs[3], more_objs[0], self.objs[4], self.objs[1], + self.objs[0], + ] + ) + @unittest.expectedFailure def test_slice_nested(self): instance = NestedIntegerArrayModel.objects.create(field=[[1, 2], [3, 4]]) |