diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-02-15 19:28:49 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2016-02-16 21:07:05 +0100 |
| commit | 928c12eb1a75dbcab22b64f8cf0afb17389c20d2 (patch) | |
| tree | b8f20f14e121e816772056d639a6a14f60adffe8 /tests/postgres_tests/test_hstore.py | |
| parent | b09b71bf3468c67a9c08654e7aa8b99efe59ebee (diff) | |
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.
Diffstat (limited to 'tests/postgres_tests/test_hstore.py')
| -rw-r--r-- | tests/postgres_tests/test_hstore.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py index 13c08386e2..8ebd757098 100644 --- a/tests/postgres_tests/test_hstore.py +++ b/tests/postgres_tests/test_hstore.py @@ -165,7 +165,8 @@ class TestQuerying(PostgreSQLTestCase): class TestSerialization(PostgreSQLTestCase): - test_data = '[{"fields": {"field": "{\\"a\\": \\"b\\"}"}, "model": "postgres_tests.hstoremodel", "pk": null}]' + test_data = ('[{"fields": {"field": "{\\"a\\": \\"b\\"}"}, ' + '"model": "postgres_tests.hstoremodel", "pk": null}]') def test_dumping(self): instance = HStoreModel(field={'a': 'b'}) @@ -176,6 +177,12 @@ class TestSerialization(PostgreSQLTestCase): instance = list(serializers.deserialize('json', self.test_data))[0].object self.assertEqual(instance.field, {'a': 'b'}) + def test_roundtrip_with_null(self): + instance = HStoreModel(field={'a': 'b', 'c': None}) + data = serializers.serialize('json', [instance]) + new_instance = list(serializers.deserialize('json', data))[0].object + self.assertEqual(instance.field, new_instance.field) + class TestValidation(PostgreSQLTestCase): |
