Пример #1
0
 def test_formattedstring_field(self):
     field = fields.FormattedString('Hello {name}')
     user = User(name='Monty')
     assert field.serialize('name', user) == 'Hello Monty'
Пример #2
0
 class MySchema(Schema):
     greeting = fields.FormattedString('Hello {name}')
Пример #3
0
 def test_metadata_may_be_added_to_formatted_string_field(self):
     field = fields.FormattedString('hello {name}',
                                    description='a greeting')
     assert field.metadata == {'description': 'a greeting'}