summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-02-15 19:28:49 +0100
committerClaude Paroz <claude@2xlibre.net>2016-02-16 21:09:16 +0100
commit205cafd01ebe0f1c72ef3772a1b3f195387f4c50 (patch)
tree52117d2195dc3afabc58134d4095787b71755f3b /tests/postgres_tests/test_array.py
parentcc7ea1905ddb4ba444b4f358c26b6bd8f1f6c93b (diff)
[1.9.x] Fixed #26215 -- Fixed RangeField/ArrayField serialization with None values
Also added tests for HStoreField and JSONField. Thanks Aleksey Bukin for the report and Tim Graham for the initial patch and the review. Backport of 928c12eb1 from master.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 094a1e2235..fe9c477d4b 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -462,17 +462,17 @@ class TestMigrations(TransactionTestCase):
class TestSerialization(PostgreSQLTestCase):
test_data = (
- '[{"fields": {"field": "[\\"1\\", \\"2\\"]"}, "model": "postgres_tests.integerarraymodel", "pk": null}]'
+ '[{"fields": {"field": "[\\"1\\", \\"2\\", null]"}, "model": "postgres_tests.integerarraymodel", "pk": null}]'
)
def test_dumping(self):
- instance = IntegerArrayModel(field=[1, 2])
+ instance = IntegerArrayModel(field=[1, 2, None])
data = serializers.serialize('json', [instance])
self.assertEqual(json.loads(data), json.loads(self.test_data))
def test_loading(self):
instance = list(serializers.deserialize('json', self.test_data))[0].object
- self.assertEqual(instance.field, [1, 2])
+ self.assertEqual(instance.field, [1, 2, None])
class TestValidation(PostgreSQLTestCase):