summaryrefslogtreecommitdiff
path: root/numpy/typing/tests/test_typing.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2021-12-01 12:36:07 +0100
committerGitHub <noreply@github.com>2021-12-01 12:36:07 +0100
commit007f433a7c99131f8e402eaec60fd3194e1e41d0 (patch)
tree39a6e2d1218d9c65a7fb56f5f6462c52a38d0462 /numpy/typing/tests/test_typing.py
parentd459954123786a23621778b2e23bde91382f20b4 (diff)
parent1f709cac3f8c06d452a89765f054a2efc5daaf59 (diff)
downloadnumpy-007f433a7c99131f8e402eaec60fd3194e1e41d0.tar.gz
Merge pull request #20470 from BvB93/function_base
ENH: Add dtype-typing support to `np.core.function_base`
Diffstat (limited to 'numpy/typing/tests/test_typing.py')
-rw-r--r--numpy/typing/tests/test_typing.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/typing/tests/test_typing.py b/numpy/typing/tests/test_typing.py
index fe58a8f4c..bb3914434 100644
--- a/numpy/typing/tests/test_typing.py
+++ b/numpy/typing/tests/test_typing.py
@@ -136,7 +136,7 @@ def test_fail(path: str) -> None:
output_mypy = OUTPUT_MYPY
assert path in output_mypy
for error_line in output_mypy[path]:
- error_line = _strip_filename(error_line)
+ error_line = _strip_filename(error_line).split("\n", 1)[0]
match = re.match(
r"(?P<lineno>\d+): (error|note): .+$",
error_line,
@@ -368,6 +368,7 @@ Expression: {}
Expected reveal: {!r}
Observed reveal: {!r}
"""
+_STRIP_PATTERN = re.compile(r"(\w+\.)+(\w+)")
def _test_reveal(
@@ -378,9 +379,8 @@ def _test_reveal(
lineno: int,
) -> None:
"""Error-reporting helper function for `test_reveal`."""
- strip_pattern = re.compile(r"(\w+\.)+(\w+)")
- stripped_reveal = strip_pattern.sub(strip_func, reveal)
- stripped_expected_reveal = strip_pattern.sub(strip_func, expected_reveal)
+ stripped_reveal = _STRIP_PATTERN.sub(strip_func, reveal)
+ stripped_expected_reveal = _STRIP_PATTERN.sub(strip_func, expected_reveal)
if stripped_reveal not in stripped_expected_reveal:
raise AssertionError(
_REVEAL_MSG.format(lineno,