summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_hstore.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py
index fef71f1ef4..0fc427f67c 100644
--- a/tests/postgres_tests/test_hstore.py
+++ b/tests/postgres_tests/test_hstore.py
@@ -195,7 +195,11 @@ class TestValidation(HStoreTestCase):
with self.assertRaises(exceptions.ValidationError) as cm:
field.clean({'a': 1}, None)
self.assertEqual(cm.exception.code, 'not_a_string')
- self.assertEqual(cm.exception.message % cm.exception.params, 'The value of "a" is not a string.')
+ self.assertEqual(cm.exception.message % cm.exception.params, 'The value of "a" is not a string or null.')
+
+ def test_none_allowed_as_value(self):
+ field = HStoreField()
+ self.assertEqual(field.clean({'a': None}, None), {'a': None})
class TestFormField(HStoreTestCase):
@@ -224,6 +228,11 @@ class TestFormField(HStoreTestCase):
value = field.clean('{"a": 1}')
self.assertEqual(value, {'a': '1'})
+ def test_none_value(self):
+ field = forms.HStoreField()
+ value = field.clean('{"a": null}')
+ self.assertEqual(value, {'a': None})
+
def test_empty(self):
field = forms.HStoreField(required=False)
value = field.clean('')