Skip to content

Commit

Permalink
test: test for #116
Browse files Browse the repository at this point in the history
  • Loading branch information
15r10nk committed Sep 22, 2024
1 parent c8fcc42 commit 2a37971
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/test_inline_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,3 +1176,55 @@ def test_starred_warns_dict():
assert {1:3} == snapshot({**{1:2}})
"""
).run_inline(["--inline-snapshot=fix"])


def test_now_like_dirty_equals():
# test for cases like https://github.com/15r10nk/inline-snapshot/issues/116

Example(
"""
from dirty_equals import DirtyEquals
from inline_snapshot import snapshot
def test_time():
now = 5
class Now(DirtyEquals):
def equals(self, other):
return other == now
assert now == snapshot(Now())
now = 6
assert 5 == snapshot(Now())
"""
).run_inline(
["--inline-snapshot=fix"],
changed_files=snapshot(
{
"test_something.py": """\
from dirty_equals import DirtyEquals
from inline_snapshot import snapshot
def test_time():
now = 5
class Now(DirtyEquals):
def equals(self, other):
return other == now
assert now == snapshot(Now())
now = 6
assert 5 == snapshot(5)
"""
}
),
)

0 comments on commit 2a37971

Please sign in to comment.