diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-06-18 13:34:35 +0200 |
---|---|---|
committer | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2021-06-18 13:42:55 +0200 |
commit | e65201fb20f539a45c33167fe31f48c0a15243b8 (patch) | |
tree | ddeb9ad0bc91ab40e24c832766b727b1f729833c /numpy/typing | |
parent | c4c4834fe01b430c35a7862d24957815ed1d0ee7 (diff) | |
download | numpy-e65201fb20f539a45c33167fe31f48c0a15243b8.tar.gz |
TST: Update the dtype typing tests
Diffstat (limited to 'numpy/typing')
-rw-r--r-- | numpy/typing/tests/data/reveal/dtype.py | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/numpy/typing/tests/data/reveal/dtype.py b/numpy/typing/tests/data/reveal/dtype.py index 215d89ead..eb1489bf3 100644 --- a/numpy/typing/tests/data/reveal/dtype.py +++ b/numpy/typing/tests/data/reveal/dtype.py @@ -1,7 +1,8 @@ import numpy as np -dtype_obj: np.dtype[np.str_] -void_dtype_obj: np.dtype[np.void] +dtype_U: np.dtype[np.str_] +dtype_V: np.dtype[np.void] +dtype_i8: np.dtype[np.int64] reveal_type(np.dtype(np.float64)) # E: numpy.dtype[{float64}] reveal_type(np.dtype(np.int64)) # E: numpy.dtype[{int64}] @@ -36,22 +37,30 @@ reveal_type(np.dtype("S8")) # E: numpy.dtype reveal_type(np.dtype(("U", 10))) # E: numpy.dtype[numpy.void] # Methods and attributes -reveal_type(dtype_obj.base) # E: numpy.dtype[numpy.str_] -reveal_type(dtype_obj.subdtype) # E: Union[Tuple[numpy.dtype[numpy.str_], builtins.tuple[builtins.int]], None] -reveal_type(dtype_obj.newbyteorder()) # E: numpy.dtype[numpy.str_] -reveal_type(dtype_obj.type) # E: Type[numpy.str_] -reveal_type(dtype_obj.name) # E: str -reveal_type(dtype_obj.names) # E: Union[builtins.tuple[builtins.str], None] - -reveal_type(dtype_obj * 0) # E: None -reveal_type(dtype_obj * 1) # E: numpy.dtype[numpy.str_] -reveal_type(dtype_obj * 2) # E: numpy.dtype[numpy.void] - -reveal_type(0 * dtype_obj) # E: Any -reveal_type(1 * dtype_obj) # E: Any -reveal_type(2 * dtype_obj) # E: Any - -reveal_type(void_dtype_obj["f0"]) # E: numpy.dtype[Any] -reveal_type(void_dtype_obj[0]) # E: numpy.dtype[Any] -reveal_type(void_dtype_obj[["f0", "f1"]]) # E: numpy.dtype[numpy.void] -reveal_type(void_dtype_obj[["f0"]]) # E: numpy.dtype[numpy.void] +reveal_type(dtype_U.base) # E: numpy.dtype[Any] +reveal_type(dtype_U.subdtype) # E: Union[None, Tuple[numpy.dtype[Any], builtins.tuple[builtins.int]]] +reveal_type(dtype_U.newbyteorder()) # E: numpy.dtype[numpy.str_] +reveal_type(dtype_U.type) # E: Type[numpy.str_] +reveal_type(dtype_U.name) # E: str +reveal_type(dtype_U.names) # E: Union[None, builtins.tuple[builtins.str]] + +reveal_type(dtype_U * 0) # E: numpy.dtype[numpy.str_] +reveal_type(dtype_U * 1) # E: numpy.dtype[numpy.str_] +reveal_type(dtype_U * 2) # E: numpy.dtype[numpy.str_] + +reveal_type(dtype_i8 * 0) # E: numpy.dtype[numpy.void] +reveal_type(dtype_i8 * 1) # E: numpy.dtype[{int64}] +reveal_type(dtype_i8 * 2) # E: numpy.dtype[numpy.void] + +reveal_type(0 * dtype_U) # E: numpy.dtype[numpy.str_] +reveal_type(1 * dtype_U) # E: numpy.dtype[numpy.str_] +reveal_type(2 * dtype_U) # E: numpy.dtype[numpy.str_] + +reveal_type(0 * dtype_i8) # E: numpy.dtype[Any] +reveal_type(1 * dtype_i8) # E: numpy.dtype[Any] +reveal_type(2 * dtype_i8) # E: numpy.dtype[Any] + +reveal_type(dtype_V["f0"]) # E: numpy.dtype[Any] +reveal_type(dtype_V[0]) # E: numpy.dtype[Any] +reveal_type(dtype_V[["f0", "f1"]]) # E: numpy.dtype[numpy.void] +reveal_type(dtype_V[["f0"]]) # E: numpy.dtype[numpy.void] |