Added tests for ArrayField lookup errors.

This commit is contained in:
Tim Graham 2016-09-19 15:55:03 -04:00
parent 911d9f4ed1
commit 3347dc6b4e
1 changed files with 10 additions and 0 deletions

View File

@ -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):