Skip to content

Commit

Permalink
TST: Add tests for integer indexing of dtypes, which seemed to be absent
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Nov 1, 2017
1 parent c420363 commit 9271d81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions numpy/core/tests/test_dtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ def make_dtype(off):
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):
Expand Down

0 comments on commit 9271d81

Please sign in to comment.