Skip to content

Commit d5b8a67

Browse files
committed
improve logic
1 parent c1e5d28 commit d5b8a67

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/common/test_tools/types.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ def __init__(self, path: Path, for_update: bool) -> None:
2525
self.for_update = for_update
2626

2727
def __eq__(self, other: object) -> bool:
28-
eq = self.content == other
29-
if not eq and isinstance(other, str) and self.for_update:
28+
if self.content == other:
29+
return True
30+
if self.for_update and isinstance(other, str):
3031
with open(self.path, "w") as f:
3132
f.write(other)
3233
pytest.xfail(reason=f"Snapshot updated: {self.path}")
33-
return eq
34+
return False
3435

3536
def __str__(self) -> str:
3637
return self.content

0 commit comments

Comments
 (0)