Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d44049

Browse files
committed
Add some tests for fancy indexing on a 2D dataset
1 parent 39eb526 commit 5d44049

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

h5py/tests/hl/test_dataset_getitem.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,30 @@ def test_indexlist(self):
471471
self.assertNumpyBehavior(self.dset, self.data, np.s_[:,[0,1,2]])
472472

473473

474+
class Test2DFloat(TestCase):
475+
476+
def setUp(self):
477+
TestCase.setUp(self)
478+
self.data = np.ones((5,3), dtype='f')
479+
self.dset = self.f.create_dataset('x', data=self.data)
480+
481+
def test_ndim(self):
482+
""" Verify number of dimensions """
483+
self.assertEqual(self.dset.ndim, 2)
484+
485+
def test_shape(self):
486+
""" Verify shape """
487+
self.assertEqual(self.dset.shape, (5, 3))
488+
489+
def test_indexlist(self):
490+
""" see issue #473 """
491+
self.assertNumpyBehavior(self.dset, self.data, np.s_[:,[0,1,2]])
492+
493+
def test_index_emptylist(self):
494+
self.assertNumpyBehavior(self.dset, self.data, np.s_[:, []])
495+
self.assertNumpyBehavior(self.dset, self.data, np.s_[[]])
496+
497+
474498
class TestVeryLargeArray(TestCase):
475499

476500
def setUp(self):

0 commit comments

Comments
 (0)