Exemplo n.º 1
0
 def test_to_representation_for_custom_field(self):
     instance = fields.ModelField(Column(self.CustomType()))
     self.assertEqual(
         instance.to_representation("PREFIX:value"),
         "value"
     )
Exemplo n.º 2
0
 def test_to_representation_for_default_field(self):
     instance = fields.ModelField(Column(types.Integer))
     self.assertEqual(instance.to_representation(10), 10)
Exemplo n.º 3
0
 def test_to_representation_for_default_field_with_processor(self):
     instance = fields.ModelField(Column(types.PickleType))
     self.assertEqual(instance.to_representation(pickle.dumps(10)), 10)
Exemplo n.º 4
0
 def test_to_internal_value_for_custom_field(self):
     instance = fields.ModelField(Column(self.CustomType()))
     self.assertEqual(
         instance.to_internal_value("value"),
         "PREFIX:value"
     )
Exemplo n.º 5
0
 def test_to_internal_value_for_default_field_with_processor(self):
     instance = fields.ModelField(Column(types.Float))
     self.assertEqual(instance.to_internal_value('10'), 10.0)
Exemplo n.º 6
0
 def test_to_internal_value_for_default_field(self):
     instance = fields.ModelField(Column(types.Integer))
     self.assertEqual(instance.to_internal_value(10), 10)
Exemplo n.º 7
0
 def test_dialect_property(self):
     instance = fields.ModelField(Column(types.Integer))
     self.assertEqual(instance.dialect, self.engine.dialect)
Exemplo n.º 8
0
 def test_get_attribute(self):
     instance = fields.ModelField(Column(types.Integer))
     self.assertEqual(instance.get_attribute(10), 10)