def test_make_instance():
"""Ensure that the schema's make instance works properly."""
peewee = pytest.importorskip('peewee')
class User(peewee.Model):
name = peewee.CharField(max_length=255)
class UserSchema(Schema):
name = fields.String()
class Meta:
model = User
data = {'name': 'Bob Blah'}
user = UserSchema.make_instance(data)
assert isinstance(user, User)
assert user.name == data['name']
评论列表
文章目录