diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-11-21 17:53:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-21 17:53:38 +0100 |
| commit | 5d32b8d63ab9a376c095f142b86bb55cdfbb95ff (patch) | |
| tree | 4a14b401261a97f8e4a294960967507d80451a2f /numpy/typing | |
| parent | f92c90ca4fd39346b25bbae076b991f4139d3089 (diff) | |
| parent | 7404cb68f20d8299a0935cb4242f37c41ab58aeb (diff) | |
| download | numpy-5d32b8d63ab9a376c095f142b86bb55cdfbb95ff.tar.gz | |
Merge pull request #22316 from seberg/void-strctured-new
ENH: Allow creating structured void scalars by passing dtype
Diffstat (limited to 'numpy/typing')
| -rw-r--r-- | numpy/typing/tests/data/fail/scalars.pyi | 5 | ||||
| -rw-r--r-- | numpy/typing/tests/data/pass/scalars.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/numpy/typing/tests/data/fail/scalars.pyi b/numpy/typing/tests/data/fail/scalars.pyi index c24f9e479..2a6c2c7ad 100644 --- a/numpy/typing/tests/data/fail/scalars.pyi +++ b/numpy/typing/tests/data/fail/scalars.pyi @@ -47,7 +47,8 @@ np.uint16(A()) # E: incompatible type np.uint32(A()) # E: incompatible type np.uint64(A()) # E: incompatible type -np.void("test") # E: incompatible type +np.void("test") # E: No overload variant +np.void("test", dtype=None) # E: No overload variant np.generic(1) # E: Cannot instantiate abstract class np.number(1) # E: Cannot instantiate abstract class @@ -62,7 +63,7 @@ np.uint64(value=0) # E: Unexpected keyword argument np.complex128(value=0.0j) # E: Unexpected keyword argument np.str_(value='bob') # E: No overload variant np.bytes_(value=b'test') # E: No overload variant -np.void(value=b'test') # E: Unexpected keyword argument +np.void(value=b'test') # E: No overload variant np.bool_(value=True) # E: Unexpected keyword argument np.datetime64(value="2019") # E: No overload variant np.timedelta64(value=0) # E: Unexpected keyword argument diff --git a/numpy/typing/tests/data/pass/scalars.py b/numpy/typing/tests/data/pass/scalars.py index 124681bcb..a5c6f96e9 100644 --- a/numpy/typing/tests/data/pass/scalars.py +++ b/numpy/typing/tests/data/pass/scalars.py @@ -113,6 +113,8 @@ np.void(True) np.void(np.bool_(True)) np.void(b"test") np.void(np.bytes_("test")) +np.void(object(), [("a", "O"), ("b", "O")]) +np.void(object(), dtype=[("a", "O"), ("b", "O")]) # Protocols i8 = np.int64() |
