예제 #1
0
 def test_to_primitive(self):
     obj = SimpleSchema(_python_data={'charfield':'charmander'})
     prim_data = obj.to_primitive(obj)
     self.assertEqual(prim_data, {'charfield':'charmander'})
예제 #2
0
 def test_traverse(self):
     obj = SimpleSchema(charfield='charmander')
     self.assertEqual(obj.dot_notation('charfield'), 'charmander')
예제 #3
0
 def test_to_python(self):
     obj = SimpleSchema(_primitive_data={'charfield':'charmander'})
     py_obj = obj.to_python({'charfield':'charmander'})
     self.assertEqual(obj._primitive_data, py_obj._primitive_data)
예제 #4
0
 def test_from_portable_primitive(self):
     obj = SimpleSchema(_primitive_data={'charfield':'charmander'})
     assert obj.charfield, 'Failed to initialize python data'
     py_obj = obj.to_python({'charfield':'charmander'})
     py_obj.normalize_portable_primitives()
     self.assertEqual(obj._primitive_data, py_obj._primitive_data)
 def test_to_portable_primitive(self):
     obj = SimpleSchema(_python_data={'charfield': 'charmander'})
     prim_data = obj.to_portable_primitive(obj)
     self.assertEqual(prim_data, {'charfield': 'charmander'})