Skip to content

Commit 449181d

Browse files
committed
check the error type
1 parent 6f1dce7 commit 449181d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pint_xarray/tests/test_expects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def func(a, b=1):
9191
group = excinfo.value
9292
assert len(group.exceptions) == 1, f"Found {len(group.exceptions)} exceptions"
9393
exc = group.exceptions[0]
94+
assert isinstance(
95+
exc, error
96+
), f"Unexpected exception type: {type(exc)}, expected {error}"
9497
if not re.search(message, str(exc)):
9598
raise AssertionError(f"exception {exc!r} did not match pattern {message!r}")
9699

@@ -233,5 +236,8 @@ def func(a, b):
233236
group = excinfo.value
234237
assert len(group.exceptions) == 1, f"Found {len(group.exceptions)} exceptions"
235238
exc = group.exceptions[0]
239+
assert isinstance(
240+
exc, error
241+
), f"Unexpected exception type: {type(exc)}, expected {error}"
236242
if not re.search(message, str(exc)):
237243
raise AssertionError(f"exception {exc!r} did not match pattern {message!r}")

0 commit comments

Comments
 (0)