Esempio n. 1
0
 def test_dictionary_field_to_python_empty_dict(self):
     ret = DictionaryField()
     input_value = ['test1', 'test2']
     res = ret.to_python(value=input_value)
     self.assertDictEqual({}, res)
Esempio n. 2
0
 def test_dictionary_field_to_python_str(self, mock_jl):
     ret = DictionaryField()
     ret.to_python(value='foo')
     mock_jl.assert_called_with('foo')
Esempio n. 3
0
 def test_dictionary_field_to_python_dict(self):
     ret = DictionaryField()
     input_dict = {'name': 'foo', 'extra': 'bar'}
     res = ret.to_python(value=input_dict)
     self.assertDictEqual(input_dict, res)
Esempio n. 4
0
 def test_dictionary_field_to_python_none(self):
     ret = DictionaryField()
     self.assertIsNone(ret.to_python(value=None))
Esempio n. 5
0
 def test_dictionary_field_to_python_empty_str(self):
     ret = DictionaryField()
     self.assertDictEqual({}, ret.to_python(value=""))
Esempio n. 6
0
 def test_dictionary_field_to_python_empty_dict(self):
     ret = DictionaryField()
     input_value = ['test1', 'test2']
     res = ret.to_python(value=input_value)
     self.assertDictEqual({}, res)
Esempio n. 7
0
 def test_dictionary_field_to_python_dict(self):
     ret = DictionaryField()
     input_dict = {'name': 'foo', 'extra': 'bar'}
     res = ret.to_python(value=input_dict)
     self.assertDictEqual(input_dict, res)
Esempio n. 8
0
 def test_dictionary_field_to_python_str(self, mock_jl):
     ret = DictionaryField()
     ret.to_python(value='foo')
     mock_jl.assert_called_with('foo')
Esempio n. 9
0
 def test_dictionary_field_to_python_empty_str(self):
     ret = DictionaryField()
     self.assertDictEqual({}, ret.to_python(value=""))
Esempio n. 10
0
 def test_dictionary_field_to_python_none(self):
     ret = DictionaryField()
     self.assertIsNone(ret.to_python(value=None))