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
Implement pickling for ValidationError #1119
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import enum | ||
import pickle | ||
import re | ||
import sys | ||
from decimal import Decimal | ||
|
@@ -1074,3 +1075,11 @@ def test_hide_input_in_json() -> None: | |
|
||
for error in exc_info.value.errors(include_input=False): | ||
assert 'input' not in error | ||
|
||
|
||
def test_validation_error_pickle() -> None: | ||
s = SchemaValidator({'type': 'int'}) | ||
with pytest.raises(ValidationError) as exc_info: | ||
s.validate_python('definitely not an int') | ||
|
||
pickle.loads(pickle.dumps(exc_info.value)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this test that the unpickled value is equivalent to the original? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll check |
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.
Should this be
like the rest?
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.
Yes 👍