Skip to content

Releases: 15r10nk/inline-snapshot

v0.5.1

20 Oct 12:26
Compare
Choose a tag to compare

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

15 Oct 13:34
Compare
Choose a tag to compare

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

29 Sep 20:02
Compare
Choose a tag to compare

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

05 Aug 15:22
Compare
Choose a tag to compare

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

14 Jul 07:17
44fb01c
Compare
Choose a tag to compare

What's Changed

  • fix: flags fix/trim/create/update are changing the matching snapshots by @15r10nk in #15

Full Changelog: v0.3.0...v0.3.1

v0.3.0

12 Jul 16:56
a976ee3
Compare
Choose a tag to compare

What's Changed

  • docs: added contributing.md by @15r10nk in #10
  • fix: snapshot the current value of mutable objects by @15r10nk in #12

BREAKING CHANGE

  • values have to be copyable with copy.deepcopy

Full Changelog: v0.2.1...v0.3.0

v0.2.1

09 Jul 19:21
43e1377
Compare
Choose a tag to compare

What's Changed

  • fix: black configuration files are respected by @15r10nk in #8

Full Changelog: v0.2.0...v0.2.1

v0.2.0

20 Jun 18:39
Compare
Choose a tag to compare

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