-
-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strict value is overidable, in all case. (especially, __init__(strict=False), and Meta.strict=True) #569
Conversation
It is a bit strange that default value of strict is delegated = object()
class BaseSchema(base.SchemaABC):
.. snip
def __init__(self, extra=None, only=(), exclude=(), prefix='', strict=delegated,
many=False, context=None, load_only=(), dump_only=(),
partial=False): |
3494a4b
to
b45e79a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need for custom object as default value implementation and using None instead is OK. See my inline comments though.
def test_default(self): | ||
assert self.SchemaWithoutMeta().strict is False | ||
|
||
def test__meta_true(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think it is safe and more common not to use double underscores in test names.
- You miss two tests when you use SchemaWithoutMeta and override with init argument (both True and False).
25c02d8
to
e32a9b1
Compare
Oh, yes I missed, adding two tests. And renaming test name (honestly, this is something like my individual habits, separating test method's name by double underscore for readability. But this is not strong will). |
👍 LGTM Just make sure to squash your 3 commits about tests into one before merging, their commit descriptions are not informative and it is completely unnecessary to have all this small fixes in master. |
e32a9b1
to
76ea7ba
Compare
sure. rebased. |
Thanks @podhmo for the PR and thanks @maximkulkin for reviewing. @podhmo : would you mind adding yourself to I consider this a bugfix, so I'll backport this to the 2.10-line branch once this is merged. |
added. |
Thanks! |
Current marshmallow's implementation is not allow to overwrite strict value by
strict=False
, when strict value is set by Meta.this pull request is the solution for #550