summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 0b788e0d23..b15d4996f2 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -5,6 +5,7 @@ import uuid
from django import forms
from django.core import exceptions, serializers, validators
+from django.core.exceptions import FieldError
from django.core.management import call_command
from django.db import IntegrityError, connection, models
from django.test import TransactionTestCase, override_settings
@@ -305,6 +306,15 @@ class TestQuerying(PostgreSQLTestCase):
[self.objs[3]]
)
+ def test_unsupported_lookup(self):
+ msg = "Unsupported lookup '0_bar' for ArrayField or join on the field not permitted."
+ with self.assertRaisesMessage(FieldError, msg):
+ list(NullableIntegerArrayModel.objects.filter(field__0_bar=[2]))
+
+ msg = "Unsupported lookup '0bar' for ArrayField or join on the field not permitted."
+ with self.assertRaisesMessage(FieldError, msg):
+ list(NullableIntegerArrayModel.objects.filter(field__0bar=[2]))
+
class TestDateTimeExactQuerying(PostgreSQLTestCase):