Releases: 15r10nk/inline-snapshot
0.20.2
0.20.1
0.20.0
Changed
-
pytest assert rewriting works now together with inline-snapshot if you use
cpython>=3.11
-
...
is now a special value to create snapshot values.
The value change inassert [5,4] == snapshot([5,...])
is now a create (previously it was a fix)
Fixed
-
fixed some issues with dataclass arguments
-
fixed an issue where --inline-snapshot=review discarded the user input and never formatted
the code if you used cpython 3.13.
0.19.3
Fixed
- raise no assertion for positional arguments inside constructor methods.
0.19.2
Fixed
-
fixed a crash when you changed the snapshot to use a custom constructor method for dataclass/pydantic models.
example:
from inline_snapshot import snapshot from pydantic import BaseModel class A(BaseModel): a: int @classmethod def from_str(cls, s): return cls(a=int(s)) def test_something(): assert A(a=2) == snapshot(A.from_str("1"))
0.19.1
Added
- added the optional
inline-snapshot[dirty-equals]
dependency to depend on the dirty-equals version which works in combination with inline-snapshot.
Fixed
-
snapshots with pydantic models can now be compared multiple times
class A(BaseModel): a: int def test_something(): for _ in [1, 2]: assert A(a=1) == snapshot(A(a=1))
0.19.0
Added
- You can now specify which tool you want to use to format your code by setting a
format-command
in your configuration.
Changed
- BREAKING-CHANGE you have to install
inline-snapshot[black]
now if you want to format your code like in the previous versions. This option is not required if you use aformat-command
.
Fixed
- Load default config values even if
[tool.inline-snapshot]
is missing.
This makes the documented default shortcuts--review
and--fix
work.
0.18.2
0.18.1
0.18.0
Added
- Support for a new
storage-dir
configuration option, to tell inline-snapshot where to store data files such as external snapshots.
Fixed
-
pydantic v1 is supported again. pydantic v1 & v2 create now the same snapshots. You can use
.dict()
to get the same snapshots like in inline-snapshot-0.15.0 for pydantic v1.class M(BaseModel): name: str def test_pydantic(): m = M(name="Tom") assert m == snapshot(M(name="Tom")) assert m.dict() == snapshot({"name": "Tom"})
-
Find
pyproject.toml
file in parent directories, not just next to the Pytest configuration file.