diff options
author | Allan Haldane <allan.haldane@gmail.com> | 2019-08-31 14:50:59 -0400 |
---|---|---|
committer | Allan Haldane <allan.haldane@gmail.com> | 2019-08-31 14:50:59 -0400 |
commit | 9b740ef1f7ccb8f5e0b5d018eb5fa4c26c7f0712 (patch) | |
tree | 76ce0fb0ce8a36d44b6027f3445a56360de6ba2f /numpy/core/tests | |
parent | 847aefc8a5dc239f2937cf369de0895e94e78533 (diff) | |
download | numpy-9b740ef1f7ccb8f5e0b5d018eb5fa4c26c7f0712.tar.gz |
BUG: PyDataType_ISUNSIZED should be False for structured types
Diffstat (limited to 'numpy/core/tests')
-rw-r--r-- | numpy/core/tests/test_dtype.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py index caaeac92d..14c1857b4 100644 --- a/numpy/core/tests/test_dtype.py +++ b/numpy/core/tests/test_dtype.py @@ -424,6 +424,20 @@ class TestRecord(object): 'itemsize':8}) assert_raises(ValueError, a.view, np.dtype([])) + d = np.dtype((np.dtype([]), 10)) + assert_equal(d.shape, (10,)) + assert_equal(d.itemsize, 0) + assert_equal(d.base, np.dtype([])) + + arr = np.fromiter((() for i in range(10)), []) + assert_equal(arr.dtype, np.dtype([])) + assert_raises(ValueError, np.frombuffer, b'', dtype=[]) + assert_equal(np.frombuffer(b'', dtype=[], count=2), + np.empty(2, dtype=[])) + + assert_raises(ValueError, np.dtype, ([], 'f8')) + assert_raises(ValueError, np.zeros(1, dtype='i4').view, []) + class TestSubarray(object): def test_single_subarray(self): |