Comment by ezyang

3 years ago

If you want to try this in Python, you can use https://github.com/ezyang/expecttest which I wrote to do expect tests in PyTorch.

My go-to library in python for this is:

https://pypi.org/project/pytest-regressions/

It's a bit different in that it'll save the expected to a different file... IMHO that's usually nicer because the test result is usually big and having it separated makes more sense.

When rerunning it's possible to run pytest with '--force-regen' and then check the git diff to see if all the changes were expected.