From 5ba60b8464cb4d7d79363cc3d185fa365dfb6c13 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 27 Feb 2021 22:58:16 +0100 Subject: Fix test for astroid update --- tests/functional/t/try_except_raise_crash.py | 11 ++++++----- tests/functional/t/try_except_raise_crash.rc | 2 ++ tests/functional/t/try_except_raise_crash.txt | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 tests/functional/t/try_except_raise_crash.rc diff --git a/tests/functional/t/try_except_raise_crash.py b/tests/functional/t/try_except_raise_crash.py index 7a1f8d972..48a043493 100644 --- a/tests/functional/t/try_except_raise_crash.py +++ b/tests/functional/t/try_except_raise_crash.py @@ -1,15 +1,16 @@ # pylint: disable=missing-docstring,too-many-ancestors, broad-except import collections.abc -from typing import TYPE_CHECKING, Any, MutableMapping +from typing import TYPE_CHECKING, Sized if TYPE_CHECKING: - BaseClass = MutableMapping[str, Any] + BaseClass = Sized else: - BaseClass = collections.abc.MutableMapping + BaseClass = collections.abc.Sized class TestBaseException(BaseClass): - pass + def __len__(self): + return 0 class TestException(TestBaseException): @@ -19,7 +20,7 @@ class TestException(TestBaseException): def test(): try: 1 / 0 - except TestException: # [try-except-raise] + except TestException: # [catching-non-exception,try-except-raise] raise except Exception: pass diff --git a/tests/functional/t/try_except_raise_crash.rc b/tests/functional/t/try_except_raise_crash.rc new file mode 100644 index 000000000..a17bb22da --- /dev/null +++ b/tests/functional/t/try_except_raise_crash.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.7 diff --git a/tests/functional/t/try_except_raise_crash.txt b/tests/functional/t/try_except_raise_crash.txt index b5d389d58..0fab918b9 100644 --- a/tests/functional/t/try_except_raise_crash.txt +++ b/tests/functional/t/try_except_raise_crash.txt @@ -1 +1,2 @@ -try-except-raise:22:4:test:The except handler raises immediately +catching-non-exception:23:11:test:"Catching an exception which doesn't inherit from Exception: TestException" +try-except-raise:23:4:test:The except handler raises immediately -- cgit v1.2.1