diff options
| author | Tim Graham <timograham@gmail.com> | 2016-09-19 15:55:03 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-20 10:14:47 -0400 |
| commit | 3347dc6b4e1987ed1bb70e9033be69c426f53e84 (patch) | |
| tree | 51de4ee0305a12138489fac7cc3f91b3ba67c3e5 /tests/postgres_tests | |
| parent | 911d9f4ed1a39f945769b7198a419850378f9824 (diff) | |
Added tests for ArrayField lookup errors.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 10 |
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): |
