summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-11-01 12:08:03 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-01 15:56:21 +0100
commit84633905273fc916e3d17883810d9969c03f73c2 (patch)
tree8dae32f550d93a832d6ddfd137fa7d25f78e1297 /tests/postgres_tests/test_array.py
parenta699595fce27d5d9c45ba83c656319593c366be9 (diff)
downloaddjango-84633905273fc916e3d17883810d9969c03f73c2.tar.gz
Refs #27808 -- Added test for saving nested ArrayField with nullable base field.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 708852f71c..379a1e9bba 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -31,6 +31,7 @@ try:
from django.contrib.postgres.forms import (
SimpleArrayField, SplitArrayField, SplitArrayWidget,
)
+ from django.db.backends.postgresql.base import PSYCOPG2_VERSION
from psycopg2.extras import NumericRange
except ImportError:
pass
@@ -140,6 +141,14 @@ class TestSaveLoad(PostgreSQLTestCase):
self.assertEqual(field.model, IntegerArrayModel)
self.assertEqual(field.base_field.model, IntegerArrayModel)
+ def test_nested_nullable_base_field(self):
+ if PSYCOPG2_VERSION < (2, 7, 5):
+ self.skipTest('See https://github.com/psycopg/psycopg2/issues/325')
+ instance = NullableIntegerArrayModel.objects.create(
+ field_nested=[[None, None], [None, None]],
+ )
+ self.assertEqual(instance.field_nested, [[None, None], [None, None]])
+
class TestQuerying(PostgreSQLTestCase):