Open e-belair opened 7 months ago
I found a way to solve the problem by using a function to remove object addresses like this:
_object_address_regex = re.compile(r'0x[a-z0-9]{12}')
def _repr_without_object_addresses(obj: Any) -> str:
return re.sub(_object_address_regex, '', obj.__repr__())
And then use like this in my test:
assert _repr_without_object_addresses(config) == snapshot
But I'm not sure it's the best way to do :thinking:
I have a test that checks some config objects that contains refs to callable functions like this:
When I test with update-snapshot, the generated snapshot contains a ref to the callable function that changes every time I start the tests.
So when I execute tests with --snapshot-update, the generated ambr file look like this:
But when I execute the test without --snapshot-update, I get the following error:
How can I deal with this case?