-
Notifications
You must be signed in to change notification settings - Fork 37
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
Compare serialized data in assertion compr & improve diff report #46
Conversation
fix: compare serialized snapshots, close #21
Codecov Report
@@ Coverage Diff @@
## master #46 +/- ##
=========================================
+ Coverage 58.89% 91.3% +32.4%
=========================================
Files 14 14
Lines 399 414 +15
=========================================
+ Hits 235 378 +143
+ Misses 164 36 -128
Continue to review full report at Codecov.
|
|
||
def test_raises_error_for_unserializable_data(snapshot_png): | ||
with pytest.raises(ValueError): | ||
assert "not a byte string" == snapshot_png |
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.
not sure if it's best to throw an error here, or consider this a failed snapshot.
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.
We could wrap the serialization with an error handler and compare the raw values if it fails
|
||
def test_raises_error_for_unserializable_data(snapshot_png): | ||
with pytest.raises(ValueError): | ||
assert "not a byte string" == snapshot_png |
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.
We could wrap the serialization with an error handler and compare the raw values if it fails
* chore: do not report on implicitly covered lines * wip: more explicit * wip: all is not what it seems * wip: run coverage without pytest-cov * wip: fix coverage source config * wip: fix coverage source config
Partially addresses #22 by spliting diff reporting line by line, similar to jest snapshot diffs.
Addresses #21 by reading raw text from the snapshot file for line by line comparison.