snapshot
forge.testingfunctionSince Forge API 1
Signaturepython
forge.testing.snapshot(value: object,*,name: str | None = None,tolerance: Mapping[str, float] | None = None,path: str | os.PathLike[str] | None = None) -> NoneCompare a run, or a mapping of numbers, with the snapshot stored for this test.
Parameters
| Name | Type | Default |
|---|---|---|
| value | object | |
| name | str | None | None |
| tolerance | Mapping[str, float] | None | None |
| path | str | os.PathLike[str] | None | None |
The file is path, or __snapshots__/<test file>/<name or test function>.json beside the
test file. With --update-snapshots (or FORGE_UPDATE_SNAPSHOTS=1) the file is written
instead, and a missing file is otherwise a failure. tolerance maps a field's dotted path or
last key to the relative and absolute tolerance its number may move by.