snapshot()[key]
General¶
It is possible to generate sub-snapshots during runtime. This sub-snapshots can be used like a normal snapshot.
Example:
s[key] can be used with every normal snapshot operation including s[key1][key2].
pytest options¶
It interacts with the following --inline-snapshot flags:
createcreate a new value if the snapshot value is undefined or create a new sub-snapshot if one is missing.trimremove sub-snapshots if they are not needed any more.
The flags fix and update are applied recursive to all sub-snapshots.