def test_to_representation_for_custom_field(self): instance = fields.ModelField(Column(self.CustomType())) self.assertEqual( instance.to_representation("PREFIX:value"), "value" )
def test_to_representation_for_default_field(self): instance = fields.ModelField(Column(types.Integer)) self.assertEqual(instance.to_representation(10), 10)
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)
def test_to_internal_value_for_custom_field(self): instance = fields.ModelField(Column(self.CustomType())) self.assertEqual( instance.to_internal_value("value"), "PREFIX:value" )
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)
def test_to_internal_value_for_default_field(self): instance = fields.ModelField(Column(types.Integer)) self.assertEqual(instance.to_internal_value(10), 10)
def test_dialect_property(self): instance = fields.ModelField(Column(types.Integer)) self.assertEqual(instance.dialect, self.engine.dialect)
def test_get_attribute(self): instance = fields.ModelField(Column(types.Integer)) self.assertEqual(instance.get_attribute(10), 10)