From ecfecb3146db357b2674b751b043c7563986cb90 Mon Sep 17 00:00:00 2001 From: John Readey Date: Tue, 1 Oct 2024 05:21:14 -0500 Subject: [PATCH] fix for wincompat in vlen test --- test/hl/test_dataset.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/test/hl/test_dataset.py b/test/hl/test_dataset.py index 622f955..9c9c31b 100644 --- a/test/hl/test_dataset.py +++ b/test/hl/test_dataset.py @@ -1671,28 +1671,23 @@ def test_scalar_compound(self): class TestVlen(BaseDataset): def test_int(self): - if platform.system() == "Windows": - # default np int type is 32 bit - dt = h5py.vlen_dtype(np.int32) - else: - # defualt np int type is 64 bit - dt = h5py.vlen_dtype(np.int64) - - ds = self.f.create_dataset('vlen', (4,), dtype=dt) + dt_int = np.int32 + dt_vlen = h5py.vlen_dtype(dt_int) + ds = self.f.create_dataset('vlen', (4,), dtype=dt_vlen) ds[0] = np.arange(3) ds[1] = np.arange(0) ds[2] = [1, 2, 3] ds[3] = np.arange(1) - self.assertArrayEqual(ds[0], np.arange(3)) - self.assertArrayEqual(ds[1], np.arange(0)) - self.assertArrayEqual(ds[2], np.array([1, 2, 3])) - self.assertArrayEqual(ds[1], np.arange(0)) + self.assertArrayEqual(ds[0], np.arange(3, dtype=dt_int)) + self.assertArrayEqual(ds[1], np.arange(0, dtype=dt_int)) + self.assertArrayEqual(ds[2], np.array([1, 2, 3], dtype=dt_int)) + self.assertArrayEqual(ds[1], np.arange(0, dtype=dt_int)) ds[0:2] = np.array([np.arange(5), np.arange(4)], dtype=object) - self.assertArrayEqual(ds[0], np.arange(5)) - self.assertArrayEqual(ds[1], np.arange(4)) + self.assertArrayEqual(ds[0], np.arange(5, dtype=dt_int)) + self.assertArrayEqual(ds[1], np.arange(4, dtype=dt_int)) ds[0:2] = np.array([np.arange(3), np.arange(3)]) - self.assertArrayEqual(ds[0], np.arange(3)) - self.assertArrayEqual(ds[1], np.arange(3)) + self.assertArrayEqual(ds[0], np.arange(3, dtype=dt_int)) + self.assertArrayEqual(ds[1], np.arange(3, dtype=dt_int)) def test_reuse_from_other(self): dt = h5py.vlen_dtype(int)