summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2021-02-24 15:37:19 +0100
committerBas van Beek <b.f.van.beek@vu.nl>2021-04-20 15:18:14 +0200
commita25f8b9f964095aebcd2b218586cdf39598c8cf6 (patch)
tree54c56272d2be93ee99d107e4d464b2993453f714
parent72c5ab87ade16cabcb21d7a9a9177fbff587a4f8 (diff)
downloadnumpy-a25f8b9f964095aebcd2b218586cdf39598c8cf6.tar.gz
TST: Update the `np.core.numerictypes` typing tests
-rw-r--r--numpy/typing/tests/data/pass/numerictypes.py18
-rw-r--r--numpy/typing/tests/data/reveal/numerictypes.py18
2 files changed, 36 insertions, 0 deletions
diff --git a/numpy/typing/tests/data/pass/numerictypes.py b/numpy/typing/tests/data/pass/numerictypes.py
index 4f205cabc..5af0d171c 100644
--- a/numpy/typing/tests/data/pass/numerictypes.py
+++ b/numpy/typing/tests/data/pass/numerictypes.py
@@ -27,3 +27,21 @@ np.find_common_type([], [np.int64, np.float32, complex])
np.find_common_type((), (np.int64, np.float32, complex))
np.find_common_type([np.int64, np.float32], [])
np.find_common_type([np.float32], [np.int64, np.float64])
+
+np.cast[int]
+np.cast["i8"]
+np.cast[np.int64]
+
+np.nbytes[int]
+np.nbytes["i8"]
+np.nbytes[np.int64]
+
+np.ScalarType
+np.ScalarType[0]
+np.ScalarType[4]
+np.ScalarType[9]
+np.ScalarType[11]
+
+np.typecodes["Character"]
+np.typecodes["Complex"]
+np.typecodes["All"]
diff --git a/numpy/typing/tests/data/reveal/numerictypes.py b/numpy/typing/tests/data/reveal/numerictypes.py
index e026158cd..0f886b3fb 100644
--- a/numpy/typing/tests/data/reveal/numerictypes.py
+++ b/numpy/typing/tests/data/reveal/numerictypes.py
@@ -16,3 +16,21 @@ reveal_type(np.sctype2char("S8")) # E: str
reveal_type(np.sctype2char(list)) # E: str
reveal_type(np.find_common_type([np.int64], [np.int64])) # E: numpy.dtype
+
+reveal_type(np.cast[int]) # E: _CastFunc
+reveal_type(np.cast["i8"]) # E: _CastFunc
+reveal_type(np.cast[np.int64]) # E: _CastFunc
+
+reveal_type(np.nbytes[int]) # E: int
+reveal_type(np.nbytes["i8"]) # E: int
+reveal_type(np.nbytes[np.int64]) # E: int
+
+reveal_type(np.ScalarType) # E: Tuple
+reveal_type(np.ScalarType[0]) # E: Type[builtins.int]
+reveal_type(np.ScalarType[4]) # E: Type[builtins.bool]
+reveal_type(np.ScalarType[9]) # E: Type[{csingle}]
+reveal_type(np.ScalarType[11]) # E: Type[{clongdouble}]
+
+reveal_type(np.typecodes["Character"]) # E: Literal['c']
+reveal_type(np.typecodes["Complex"]) # E: Literal['FDG']
+reveal_type(np.typecodes["All"]) # E: Literal['?bhilqpBHILQPefdgFDGSUVOMm']