Skip to content

Commit

Permalink
Fix test for astroid update
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored and Pierre-Sassoulas committed Feb 28, 2021
1 parent 9ee7753 commit 5ba60b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions tests/functional/t/try_except_raise_crash.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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
2 changes: 2 additions & 0 deletions tests/functional/t/try_except_raise_crash.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[testoptions]
min_pyver=3.7
3 changes: 2 additions & 1 deletion tests/functional/t/try_except_raise_crash.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5ba60b8

Please sign in to comment.