Skip to content

Commit 7e01f9e

Browse files
committed
Make exception type check in assertRaises more precise
1 parent f51090d commit 7e01f9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypyc/test-data/fixtures/testutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def assertRaises(typ: type, msg: str = '') -> Iterator[None]:
4545
try:
4646
yield
4747
except Exception as e:
48-
assert isinstance(e, typ), f"{e!r} is not a {typ.__name__}"
48+
assert type(e) is typ, f"{e!r} is not a {typ.__name__}"
4949
assert msg in str(e), f'Message "{e}" does not match "{msg}"'
5050
else:
5151
assert False, f"Expected {typ.__name__} but got no exception"

0 commit comments

Comments
 (0)