Skip to content

Commit

Permalink
Merge pull request #188 from mattjala/multimanager_selection
Browse files Browse the repository at this point in the history
Test MultiManager + Field Selection
  • Loading branch information
mattjala authored Apr 29, 2024
2 parents 5710666 + 6e8eb7c commit ef07ddd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions test/hl/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2353,10 +2353,10 @@ def test_multi_selection_rw(self):
for i in range(count):
np.testing.assert_array_equal(data_out[i][6:, 6:, 6:], data_in_original[i][6:, 6:, 6:])

"""
TBD - Field selection in h5pyd seems to work slightly different than in h5py
def test_multi_write_field_selection(self):
Testing writing to a field selection on multiple datasets
"""
Test writing to a field selection on multiple datasets
"""
dt = np.dtype([('a', np.float32), ('b', np.int32), ('c', np.float32)])
shape = (100,)
data = np.ones(shape, dtype=dt)
Expand All @@ -2365,8 +2365,8 @@ def test_multi_write_field_selection(self):

for i in range(count):
dset = self.f.create_dataset("data" + str(i), shape=shape,
data=np.zeros(shape, dtype=dt),
dtype=dt)
data=np.zeros(shape, dtype=dt),
dtype=dt)
datasets.append(dset)

# Perform write to field 'b'
Expand All @@ -2378,7 +2378,14 @@ def test_multi_write_field_selection(self):
np.testing.assert_array_equal(out['a'], np.zeros(shape, dtype=dt['a']))
np.testing.assert_array_equal(out['b'], data['b'])
np.testing.assert_array_equal(out['c'], np.zeros(shape, dtype=dt['c']))
"""

# Test writing to entire compound type
data = np.zeros(shape, dtype=dt)
mm[...] = [data, data, data]

for i in range(count):
out = np.array(self.f["data" + str(i)], dtype=dt)
np.testing.assert_array_equal(out, data)


if __name__ == '__main__':
Expand Down

0 comments on commit ef07ddd

Please sign in to comment.