diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/memoryview/numpy_memoryview.pyx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/memoryview/numpy_memoryview.pyx b/tests/memoryview/numpy_memoryview.pyx index 2af6bfea4..7f98352a6 100644 --- a/tests/memoryview/numpy_memoryview.pyx +++ b/tests/memoryview/numpy_memoryview.pyx @@ -734,3 +734,29 @@ def same_type_after_arrays_composite(): cdef SameTypeAfterArraysStructComposite element arr = np.ones(2, np.asarray(<SameTypeAfterArraysStructComposite[:1]>&element).dtype) cdef SameTypeAfterArraysStructComposite[:] memview = arr + +ctypedef fused np_numeric_t: + np.float64_t + +def test_invalid_buffer_fused_memoryview(np_numeric_t[:] A): + """ + >>> import numpy as np + >>> zz = np.zeros([5], dtype='M') + >>> test_invalid_buffer_fused_memoryview(zz) + Traceback (most recent call last): + ... + TypeError: No matching signature found + """ + return + +ctypedef fused np_numeric_object_t: + np.float64_t[:] + object + +def test_valid_buffer_fused_memoryview(np_numeric_object_t A): + """ + >>> import numpy as np + >>> zz = np.zeros([5], dtype='M') + >>> test_valid_buffer_fused_memoryview(zz) + """ + return |