Skip to content

Commit dfa7711

Browse files
committed
Fix dtype in windows tests
1 parent bd23e19 commit dfa7711

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

test/hl/test_dataset.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_missing_shape(self):
157157
def test_long_double(self):
158158
""" Confirm that the default dtype is float """
159159
# Expected failure on HSDS; skip with h5py
160-
if config.get('use_h5py'):
160+
if config.get('use_h5py') or platform.system() == 'Windows':
161161
self.assertTrue(False)
162162

163163
dset = self.f.create_dataset('foo', (63,), dtype=np.longdouble)
@@ -1671,7 +1671,13 @@ def test_scalar_compound(self):
16711671

16721672
class TestVlen(BaseDataset):
16731673
def test_int(self):
1674-
dt = h5py.vlen_dtype(int)
1674+
if platform.system() == "Windows":
1675+
# default np int type is 32 bit
1676+
dt = h5py.vlen_dtype(np.int32)
1677+
else:
1678+
# defualt np int type is 64 bit
1679+
dt = h5py.vlen_dtype(np.int64)
1680+
16751681
ds = self.f.create_dataset('vlen', (4,), dtype=dt)
16761682
ds[0] = np.arange(3)
16771683
ds[1] = np.arange(0)
@@ -1708,7 +1714,12 @@ def test_reuse_struct_from_other(self):
17081714
self.f.create_dataset('vlen2', (1,), self.f['vlen']['b'][()].dtype)
17091715

17101716
def test_convert(self):
1711-
dt = h5py.vlen_dtype(int)
1717+
if platform.system() == "Windows":
1718+
# default np int type is 32 bit
1719+
dt = h5py.vlen_dtype(np.int32)
1720+
else:
1721+
# defualt np int type is 64 bit
1722+
dt = h5py.vlen_dtype(np.int64)
17121723
ds = self.f.create_dataset('vlen', (3,), dtype=dt)
17131724
ds[0] = np.array([1.4, 1.2])
17141725
ds[1] = np.array([1.2])
@@ -1725,7 +1736,13 @@ def test_convert(self):
17251736
self.assertArrayEqual(ds[1], np.arange(3))
17261737

17271738
def test_multidim(self):
1728-
dt = h5py.vlen_dtype(int)
1739+
if platform.system() == "Windows":
1740+
# default np int type is 32 bit
1741+
dt = h5py.vlen_dtype(np.int32)
1742+
else:
1743+
# defualt np int type is 64 bit
1744+
dt = h5py.vlen_dtype(np.int64)
1745+
17291746
ds = self.f.create_dataset('vlen', (2, 2), dtype=dt)
17301747
# ds[0, 0] = np.arange(1)
17311748
ds[:, :] = np.array([[np.arange(3), np.arange(2)],

0 commit comments

Comments
 (0)