diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-03-22 17:15:15 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-11-01 01:19:20 -0700 |
commit | 9271d814517a4078faf6766594d0f93196b44990 (patch) | |
tree | dd227c4a1d3b1162c83b757e2208653812b8ad44 | |
parent | c420363d150cdfa386d602864ddfb4729e9f0861 (diff) | |
download | python-numpy-9271d814517a4078faf6766594d0f93196b44990.tar.gz python-numpy-9271d814517a4078faf6766594d0f93196b44990.tar.bz2 python-numpy-9271d814517a4078faf6766594d0f93196b44990.zip |
TST: Add tests for integer indexing of dtypes, which seemed to be absent
-rw-r--r-- | numpy/core/tests/test_dtype.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py index 9cefb2ad1..7f5ab2c9d 100644 --- a/numpy/core/tests/test_dtype.py +++ b/numpy/core/tests/test_dtype.py @@ -298,6 +298,14 @@ class TestRecord(object): dt = make_dtype(np.uint32(0)) np.zeros(1, dtype=dt)[0].item() + def test_fields_by_index(self): + dt = np.dtype([('a', np.int8), ('b', np.float32, 3)]) + assert_dtype_equal(dt[0], np.dtype(np.int8)) + assert_dtype_equal(dt[1], np.dtype((np.float32, 3))) + assert_dtype_equal(dt[-1], dt[1]) + assert_dtype_equal(dt[-2], dt[0]) + assert_raises(IndexError, lambda: dt[-3]) + class TestSubarray(object): def test_single_subarray(self): |