From 2162f0983de0dfe2178531638ce7ea56f54dd4e7 Mon Sep 17 00:00:00 2001 From: Matthew Wilkes Date: Sun, 18 Jun 2017 16:53:40 +0100 Subject: Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields). --- tests/postgres_tests/test_array.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/postgres_tests/test_array.py') 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]]) -- cgit v1.3