File: test_update.py

package info (click to toggle)
python-inline-snapshot 0.23.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,116 kB
  • sloc: python: 6,888; makefile: 34; sh: 28
file content (36 lines) | stat: -rw-r--r-- 729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sys

from inline_snapshot import snapshot
from inline_snapshot.testing._example import Example

executable = sys.executable.replace("\\", "\\\\")


def test_no_reported_updates():

    Example(
        {
            "fmt_cmd.py": """\
from sys import stdin

text=stdin.read()
text=text.replace("8","4+4")
print(text,end="")
""",
            "pyproject.toml": f"""\
[tool.inline-snapshot]
format-command="{executable} fmt_cmd.py {{filename}}"
show-updates=true
""",
            "test_a.py": """\
from inline_snapshot import snapshot

def test_a():
    assert 2**3 == snapshot(4+4)
""",
        }
    ).run_pytest(
        ["--inline-snapshot=report"],
        changed_files=snapshot({}),
        report=snapshot(""),
    )