Describe the Changes
Recursive objects are now caught and removed during the default_encode_value method.
Example Code
If you have added to the public API, please provide a code sample of how
to use these additions.
def test_recursive_object(snapshot):
value = dict()
value["value"] = value
value["name"] = "recursive object"
# This no longer errors and will make the snapshot: {"name": "recursive object"}
snapshot.assert_match(value)
Additional Notes
Originally I was planning on wrapping these values in a way that they could remain in the snapshots, but this seems to not be possible due to either:
1) We replace them with some "recursive object" tag, in which case we cannot tell if two recursive objects are the same during the assertion phase.
2) We wrap recursive objects and encode to which object they are recursive to, but this seemed to complicated and might confuse the user.
Describe the Changes Recursive objects are now caught and removed during the
default_encode_value
method.Example Code If you have added to the public API, please provide a code sample of how to use these additions.
Additional Notes Originally I was planning on wrapping these values in a way that they could remain in the snapshots, but this seems to not be possible due to either: 1) We replace them with some "recursive object" tag, in which case we cannot tell if two recursive objects are the same during the assertion phase. 2) We wrap recursive objects and encode to which object they are recursive to, but this seemed to complicated and might confuse the user.
Closes #58