Skip to content

Commit

Permalink
fix numpy 2.0 vs 2.1.1 incompat issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Sep 30, 2024
1 parent e38480c commit 5a71742
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/hl/test_dataset_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def test_multi_read_vlen_str(self):

for i in range(count):
self.assertEqual(out[i].dtype, dt)
out[i] = np.reshape(out[i], shape=np.prod(shape))
out[i] = np.reshape(np.array([s.decode() for s in out[i]], dtype=dt), shape=shape)
out[i] = out[i].reshape(np.prod(shape))
out[i] = np.array([s.decode() for s in out[i]], dtype=dt).reshape(shape)
np.testing.assert_array_equal(out[i], data_in)

def test_multi_read_mixed_shapes(self):
Expand All @@ -234,7 +234,7 @@ def test_multi_read_mixed_shapes(self):
count = 3
dt = np.int32
data = np.arange(150, dtype=dt)
data_in = [np.reshape(data, shape=s) for s in shapes]
data_in = [data.reshape(s) for s in shapes]
datasets = []
sel_idx = 2

Expand Down Expand Up @@ -296,12 +296,12 @@ def test_multi_write_non_scalar_dataspaces(self):
zeros = np.zeros(shape, dtype=dt)
data_in = []
datasets = []

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

d_in = np.array(np.reshape(np.arange(np.prod(shape)), shape) + i, dtype=dt)
d_in = arr + i
data_in.append(d_in)

mm = MultiManager(datasets)
Expand Down Expand Up @@ -393,11 +393,12 @@ def test_multi_write_vlen_str(self):

# Verify
for i in range(count):
out = f["data" + str(i)][...]
self.assertEqual(out.dtype, dt)
arr = f["data" + str(i)][...]
self.assertEqual(arr.dtype, dt)

out = np.reshape(out, shape=np.prod(shape))
out = np.reshape(np.array([s.decode() for s in out], dtype=dt), shape=shape)
arr = arr.reshape(np.prod(shape))
out = np.array([s.decode() for s in arr], dtype=dt)
out = out.reshape(shape)
np.testing.assert_array_equal(out, data_in_vlen)

def test_multi_write_mixed_shapes(self):
Expand Down

0 comments on commit 5a71742

Please sign in to comment.