create and update inline snapshots in your python tests
MIT License
Bot releases are visible (Hide)
enum.Enum
, enum.Flag
, type
and omitting of default valuesFull Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.2...v0.11.0
Published by 15r10nk 5 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.1...v0.10.2
Published by 15r10nk 5 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.10.0...v0.10.1
Published by 15r10nk 5 months ago
--inline-snapshot-disable
option and replaced it with --inline-snapshot=disable
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.9.0...v0.10.0
Published by 15r10nk 5 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.2...v0.9.0
Published by 15r10nk 6 months ago
from inline_snapshot import snapshot as snap
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.1...v0.8.2
Published by 15r10nk 6 months ago
fixed problems with the typing of the following snapshots:
snapshot([])
snapshot({})
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.8.0...v0.8.1
Published by 15r10nk 6 months ago
Snapshot parts can now be replaced by dirty-equals expressions. These parts will not be changed if the user uses --inline-snapshot=fix
. This should provide more flexibility if snapshots change frequently for unimportant reasons.
from inline_snapshot import snapshot
from dirty_equals import IsDatetime
import datetime
def get_data():
return {
"date": datetime.datetime.utcnow(),
"payload": "some data",
}
def test_function():
assert get_data() == snapshot(
{
"date": IsDatetime(),
"payload": "some data",
}
)
Thank you to @alexmojaki for the Idea.
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.7.0...v0.8.0
Published by 15r10nk 8 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.6.1...v0.7.0
Published by 15r10nk 9 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.6.0...v0.6.1
Published by 15r10nk 10 months ago
snapshot values can now be saved in external files:
assert outsource("large string\n" * 1000) == snapshot(external("8bf10bdf2c30*.txt"))
see the documentation for more details
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.2...v0.6.0
Published by 15r10nk 11 months ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.1...v0.5.2
Published by 15r10nk 12 months ago
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`
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.5.0...v0.5.1
Published by 15r10nk about 1 year ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.4.0...v0.5.0
Published by 15r10nk about 1 year ago
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\
"""
)
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.2...v0.4.0
Published by 15r10nk about 1 year ago
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
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.1...v0.3.2
Published by 15r10nk over 1 year ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.3.0...v0.3.1
Published by 15r10nk over 1 year ago
copy.deepcopy
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.2.1...v0.3.0
Published by 15r10nk over 1 year ago
Full Changelog: https://github.com/15r10nk/inline-snapshot/compare/v0.2.0...v0.2.1
Published by 15r10nk over 1 year ago
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:
more information can be found in the new documentation