Releases: 15r10nk/inline-snapshot
Releases · 15r10nk/inline-snapshot
v0.5.1
show the user better error messages when he mixes snapshot operations.
def test_something():
s = snapshot(5)
assert 5 <= s
assert 5 == s
> assert 5 == s
E TypeError: This snapshot cannot be use with `==`, because it was previously used with `x <= snapshot`
What's Changed
Full Changelog: v0.5.0...v0.5.1
v0.5.0
What's Changed
- fix: do not change an empty snapshot if it is not used
- 3.12 support
Full Changelog: v0.4.0...v0.5.0
v0.4.0
Escaped newlines for multiline strings
Multiline strings are now formatted so that the quotes are always on a separate line.
def test_something():
assert "\nfirst line\nsecond line" == snapshot(
"""\
first line
second line\
"""
)
What's Changed
Full Changelog: v0.3.2...v0.4.0
v0.3.2
correct handling of flags for sub-snapshots:
from inline_snapshot import snapshot
def test_foo():
s = snapshot(
{
"hello": "world",
"number": 8,
"values": ["old value"], # trim: remove "old value"
}
)
assert "mars" == s["hello"] # fix: change "world" to "mars"
assert 5 <= s["number"] # trim: change 8 to 5
assert "some output" in s["known output"] # create: add "known output": ["some output"]
assert "new value" in s["values"] # fix: add "new value"
pytest --inline-snapshot=create|fix|trim
will apply the changes to the snapshot
every flag implies --inline-snapshot=update
What's Changed
- fix: string literal concatenation should trigger no update by @15r10nk in #23
- fix: fixed edge cases where sub-snapshots had problems with some flags by @15r10nk in #22
Full Changelog: v0.3.1...v0.3.2
v0.3.1
v0.3.0
v0.2.1
v0.2.0
support for new snapshot operations:
value <= snapshot()
to ensure that something gets smaller/larger over time (number of iterations of an algorithm you want to optimize for example),value in snapshot()
to check if your value is in a known set of values,snapshot()[key]
to generate new sub-snapshots on demand.
new features:
- convert strings with newlines to triple quoted strings
- preserve black formatting
more information can be found in the new documentation