Skip to content

Commit 4b8973d

Browse files
committed
BUG: fix logic error in the typing test_fail test
1 parent 3ac109a commit 4b8973d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

numpy/typing/tests/test_typing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def test_fail(path: str) -> None:
168168
target_line = lines[lineno - 1]
169169
if "# E:" in target_line:
170170
expression, _, marker = target_line.partition(" # E: ")
171-
expected_error = errors[lineno].strip()
172-
marker = marker.strip()
173-
_test_fail(path, expression, marker, expected_error, lineno)
171+
error = errors[lineno].strip()
172+
expected_error = marker.strip()
173+
_test_fail(path, expression, error, expected_error, lineno)
174174
else:
175175
pytest.fail(
176176
f"Unexpected mypy output at line {lineno}\n\n{errors[lineno]}"
@@ -200,7 +200,7 @@ def _test_fail(
200200
) -> None:
201201
if expected_error is None:
202202
raise AssertionError(_FAIL_MSG1.format(lineno, expression, error))
203-
elif error not in expected_error:
203+
elif expected_error not in error:
204204
raise AssertionError(_FAIL_MSG2.format(
205205
lineno, expression, expected_error, error
206206
))

0 commit comments

Comments
 (0)