From 47c0fc3d78a6db8bbe6c298dec76084142f59171 Mon Sep 17 00:00:00 2001 From: Reagan Lee <96998476+reaganjlee@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:36:22 -0700 Subject: [PATCH] tests --- testing/test_assertrewrite.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index e1b71ded6..d85c8bed6 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -685,6 +685,21 @@ class TestAssertionRewrite: assert msg is not None assert " < 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 f() -> None: assert "%test" == "test" # type: ignore[comparison-overlap]