def test_schema_opts_allow_none_used(): opts = SchemaOptions(allow_none=True) class S(Schema): name = fields.String() schema = S() schema.config({'options': opts}) assert schema.serialize({'name': None}) == {'name': None}
class Meta: options = SchemaOptions(output_missing=True)
class S(Schema): __schema_options__ = SchemaOptions(raise_errors=False) name = fields.String(required=True)
class Meta: options = SchemaOptions(allow_none=True)
def test_schema_opts_cls_overrides(): opts = SchemaOptions(allow_none=True) assert opts.allow_none == True
def test_schema_opts_cls(): opts = SchemaOptions() assert opts.allow_none == False