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 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
from inline_snapshot import snapshot
from inline_snapshot.testing import Example
def test_uuid_storage():
Example(
"""
from inline_snapshot import external
s=external("uuid:")
def test_a():
assert "value" == external("uuid:")
assert "blub"==s
"""
).run_inline(
["--inline-snapshot=create"],
changed_files=snapshot(
{
"tests/__inline_snapshot__/test_something/__module__/f728b4fa-4248-4e3a-8a5d-2f346baa9455.txt": "blub",
"tests/__inline_snapshot__/test_something/test_a/e3e70682-c209-4cac-a29f-6fbed82c07cd.txt": "value",
"tests/test_something.py": """\
from inline_snapshot import external
s=external("uuid:f728b4fa-4248-4e3a-8a5d-2f346baa9455.txt")
def test_a():
assert "value" == external("uuid:e3e70682-c209-4cac-a29f-6fbed82c07cd.txt")
assert "blub"==s
\
""",
}
),
).replace(
'"value"', '"new_value"'
).run_inline(
["--inline-snapshot=create"],
changed_files=snapshot({}),
raises=snapshot("AssertionError:\n"),
).run_inline(
["--inline-snapshot=fix"],
changed_files=snapshot(
{
"tests/__inline_snapshot__/test_something/test_a/e3e70682-c209-4cac-a29f-6fbed82c07cd.txt": "new_value"
}
),
).run_inline(
["--inline-snapshot=disable"], changed_files=snapshot({})
)
|