diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-06-17 21:21:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 21:21:58 +0300 |
commit | 02883d85b5d3f68c12cb1df75f96e0fed741d4a4 (patch) | |
tree | 17d344fa051f564d360ef0726018fba99fde64cf /numpy/tests | |
parent | 95a6774007d1d7898c7da40d9989e9f1dd1b0f40 (diff) | |
parent | d985e8ca2fca154d3770c842a2da1ba6dc3aaf1c (diff) | |
download | numpy-02883d85b5d3f68c12cb1df75f96e0fed741d4a4.tar.gz |
Merge pull request #16558 from person142/typing-runtime
ENH: make typing module available at runtime
Diffstat (limited to 'numpy/tests')
-rw-r--r-- | numpy/tests/test_public_api.py | 3 | ||||
-rw-r--r-- | numpy/tests/typing/fail/array_like.py | 8 | ||||
-rw-r--r-- | numpy/tests/typing/pass/array_like.py | 10 |
3 files changed, 5 insertions, 16 deletions
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py index 9fa61951a..df0e04285 100644 --- a/numpy/tests/test_public_api.py +++ b/numpy/tests/test_public_api.py @@ -102,7 +102,7 @@ def test_dir_testing(): """Assert that output of dir has only one "testing/tester" attribute without duplicate""" assert len(dir(np)) == len(set(dir(np))) - + def test_numpy_linalg(): bad_results = check_dir(np.linalg) @@ -180,6 +180,7 @@ PUBLIC_MODULES = ['numpy.' + s for s in [ "polynomial.polyutils", "random", "testing", + "typing", "version", ]] diff --git a/numpy/tests/typing/fail/array_like.py b/numpy/tests/typing/fail/array_like.py index a5ef5795f..a97e72dc7 100644 --- a/numpy/tests/typing/fail/array_like.py +++ b/numpy/tests/typing/fail/array_like.py @@ -1,11 +1,5 @@ -from typing import Any, TYPE_CHECKING - import numpy as np - -if TYPE_CHECKING: - from numpy.typing import ArrayLike -else: - ArrayLike = Any +from numpy.typing import ArrayLike class A: diff --git a/numpy/tests/typing/pass/array_like.py b/numpy/tests/typing/pass/array_like.py index 098149c4b..e668b4963 100644 --- a/numpy/tests/typing/pass/array_like.py +++ b/numpy/tests/typing/pass/array_like.py @@ -1,13 +1,7 @@ -from typing import Any, List, Optional, TYPE_CHECKING +from typing import Any, List, Optional import numpy as np - -if TYPE_CHECKING: - from numpy.typing import ArrayLike, DtypeLike, _SupportsArray -else: - ArrayLike = Any - DtypeLike = Any - _SupportsArray = Any +from numpy.typing import ArrayLike, DtypeLike, _SupportsArray x1: ArrayLike = True x2: ArrayLike = 5 |