Skip to content

Commit 47c0fc3

Browse files
committed
tests
1 parent 02ba39b commit 47c0fc3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/test_assertrewrite.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,21 @@ def myany(x) -> bool:
685685
assert msg is not None
686686
assert "<MY42 object> < 0" in msg
687687

688+
def test_assert_handling_raise_in__iter__(self) -> None:
689+
def f() -> None:
690+
class A:
691+
def __iter__(self):
692+
raise TypeError("user message")
693+
694+
def __eq__(self, o: object) -> bool:
695+
return self is o
696+
697+
assert A() == A()
698+
699+
msg = getmsg(f)
700+
assert msg is not None
701+
assert "Unexpected exception" in msg
702+
688703
def test_formatchar(self) -> None:
689704
def f() -> None:
690705
assert "%test" == "test" # type: ignore[comparison-overlap]

0 commit comments

Comments
 (0)