summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorMatthew Wilkes <git@matthewwilkes.name>2016-06-02 11:05:25 -0700
committerTim Graham <timograham@gmail.com>2016-08-19 13:40:56 -0400
commit4f138fe5a496a81115c4fba6615a517fc62c3b17 (patch)
tree599a3f1d8d08d75d0631138151386ee07f29b2c8 /tests/postgres_tests
parentf6cd669ff203192c29495174e53da6b16883b039 (diff)
Fixed #22288 -- Fixed F() expressions with the __range lookup.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_array.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 6dd1fb85e0..2b5796dc6f 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -173,12 +173,40 @@ class TestQuerying(PostgreSQLTestCase):
self.objs[:2]
)
+ @unittest.expectedFailure
+ def test_in_including_F_object(self):
+ # This test asserts that Array objects passed to filters can be
+ # constructed to contain F objects. This currently doesn't work as the
+ # psycopg2 mogrify method that generates the ARRAY() syntax is
+ # expecting literals, not column references (#27095).
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(field__in=[[models.F('id')]]),
+ self.objs[:2]
+ )
+
+ def test_in_as_F_object(self):
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(field__in=[models.F('field')]),
+ self.objs[:4]
+ )
+
def test_contained_by(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__contained_by=[1, 2]),
self.objs[:2]
)
+ @unittest.expectedFailure
+ def test_contained_by_including_F_object(self):
+ # This test asserts that Array objects passed to filters can be
+ # constructed to contain F objects. This currently doesn't work as the
+ # psycopg2 mogrify method that generates the ARRAY() syntax is
+ # expecting literals, not column references (#27095).
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(field__contained_by=[models.F('id'), 2]),
+ self.objs[:2]
+ )
+
def test_contains(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__contains=[2]),