コード例 #1
0
 def test_not_a_string(self):
     field = HStoreField()
     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 or null.')
コード例 #2
0
ファイル: test_hstore.py プロジェクト: 01-/django
 def test_not_a_string(self):
     field = HStoreField()
     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.')
コード例 #3
0
 def test_none_allowed_as_value(self):
     field = HStoreField()
     self.assertEqual(field.clean({'a': None}, None), {'a': None})