This commit is contained in:
Reagan Lee 2023-08-10 16:36:22 -07:00
parent 02ba39bfcd
commit 47c0fc3d78
1 changed files with 15 additions and 0 deletions

View File

@ -685,6 +685,21 @@ class TestAssertionRewrite:
assert msg is not None assert msg is not None
assert "<MY42 object> < 0" in msg assert "<MY42 object> < 0" in msg
def test_assert_handling_raise_in__iter__(self) -> None:
def f() -> None:
class A:
def __iter__(self):
raise TypeError("user message")
def __eq__(self, o: object) -> bool:
return self is o
assert A() == A()
msg = getmsg(f)
assert msg is not None
assert "Unexpected exception" in msg
def test_formatchar(self) -> None: def test_formatchar(self) -> None:
def f() -> None: def f() -> None:
assert "%test" == "test" # type: ignore[comparison-overlap] assert "%test" == "test" # type: ignore[comparison-overlap]