mirror of
https://github.com/django/django.git
synced 2025-08-26 21:44:31 +00:00
Fixed #22288 -- Fixed F() expressions with the __range lookup.
This commit is contained in:
parent
f6cd669ff2
commit
4f138fe5a4
11 changed files with 292 additions and 21 deletions
|
@ -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]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue