-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersserializerSyrupy serializer questionSyrupy serializer question
Milestone
Description
Describe the bug
It appears that if you snapshot test against an object whose repr ends in a newline, then the test will fail even after running --snapshot-update
To reproduce
# test_syrupy.py
class X:
def __repr__(self):
return "X\n"
def test_syrupy(snapshot):
assert X() == snapshotThen run pytest test_syrupy.py --snapshot-update then pytest teest_syrupy.py
The test fails with the following output
test_syrupy.py F [100%]
=================================================================================================== FAILURES ===================================================================================================
_________________________________________________________________________________________________ test_syrupy __________________________________________________________________________________________________
snapshot = X
def test_syrupy(snapshot):
> assert X() == snapshot
E assert [+ received] == [- snapshot]
E - X
E + X
Expected behavior
I expect the test to pass
Environment (please complete the following information):
- OS: MacOS 14.7
- Syrupy Version: 4.8.0
- Python Version: 3.11.4
JohnScolaro
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersserializerSyrupy serializer questionSyrupy serializer question
Type
Projects
Status
Done