def test_marshmallow_schema():
 class UserSchema(Schema, ):
  name = fields.Str()
 schema_type = hug.types.MarshmallowSchema(UserSchema())
 assert (schema_type({'name': 'test'}) == {'name': 'test'})
 assert (schema_type('{"name": "test"}') == {'name': 'test'})
 assert (schema_type.__doc__ == 'UserSchema')
 with pytest.raises(InvalidTypeData):
  schema_type({'name': 1})

def test_marshmallow_schema ( ) : class UserSchema ( Schema , ) : name = fields . Str ( ) schema_type = hug . types . MarshmallowSchema ( UserSchema ( ) ) assert ( schema_type ( { 'name' : 'test' } ) == { 'name' : 'test' } ) assert ( schema_type ( '{"name": "test"}' ) == { 'name' : 'test' } ) assert ( schema_type . __doc__ == 'UserSchema' ) with pytest . raises ( InvalidTypeData ) : schema_type ( { 'name' : 1 } )
test hugs marshmallow schema support .