You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tests inside test_enum.TestValidator have relied on a wrong operator binding order and thus
two cases that are actually not valid marshmallow were tested to be valid.
The issue is the following line:
assert not res == is_valid
res here is the output of schema.validate(), which returns a dict of validation errors.
However, not as lower precedence than == (see here), so the statement was treated as
assert not (res == is_valid)
which was Trueno matter what, since we compared a dict to a bool.
After fixing the precedence, two test cases fail: TestValidator.test_data_with_enum(1, True) and (1.23, True), because marshmallow does in fact not allow int enum values (there is a marshmallow_enum in the ecosystem here).
I will enclose a pull request that tests that these cases are actually False.
I found this while implementing a feature that allows enums as dict keys, which I will also link. @lidatong
The text was updated successfully, but these errors were encountered:
The tests inside
test_enum.TestValidator
have relied on a wrong operator binding order and thustwo cases that are actually not valid marshmallow were tested to be valid.
The issue is the following line:
res
here is the output ofschema.validate()
, which returns a dict of validation errors.However,
not
as lower precedence than==
(see here), so the statement was treated aswhich was
True
no matter what, since we compared a dict to a bool.After fixing the precedence, two test cases fail:
TestValidator.test_data_with_enum
(1, True)
and(1.23, True)
, because marshmallow does in fact not allow int enum values (there is a marshmallow_enum in the ecosystem here).I will enclose a pull request that tests that these cases are actually
False
.I found this while implementing a feature that allows enums as dict keys, which I will also link.
@lidatong
The text was updated successfully, but these errors were encountered: