18
18
19
19
20
20
@pytest .mark .parametrize ("store" , stores .keys ())
21
- def test_helpers (tmpdir , store ):
21
+ @pytest .mark .parametrize ("dtype" , [np .float32 , np .uint8 , np .uint64 ])
22
+ def test_helpers (tmpdir , store , dtype ):
22
23
store = tmpdir / store
23
24
metadata = MetaDataFormat ().parse (
24
25
{
@@ -41,7 +42,7 @@ def test_helpers(tmpdir, store):
41
42
metadata .units ,
42
43
shape ,
43
44
chunk_shape ,
44
- dtype = np . float32 ,
45
+ dtype = dtype ,
45
46
mode = "r" ,
46
47
)
47
48
@@ -54,7 +55,7 @@ def test_helpers(tmpdir, store):
54
55
metadata .units ,
55
56
shape ,
56
57
chunk_shape ,
57
- dtype = np . float32 ,
58
+ dtype = dtype ,
58
59
mode = "w" ,
59
60
)
60
61
assert array .roi == Roi (
@@ -74,7 +75,7 @@ def test_helpers(tmpdir, store):
74
75
metadata .units ,
75
76
shape ,
76
77
chunk_shape ,
77
- dtype = np . float32 ,
78
+ dtype = dtype ,
78
79
mode = "r" ,
79
80
)
80
81
assert array .roi == Roi (
@@ -96,7 +97,7 @@ def test_helpers(tmpdir, store):
96
97
metadata .units ,
97
98
chunk_shape ,
98
99
chunk_shape ,
99
- dtype = np . float32 ,
100
+ dtype = dtype ,
100
101
mode = "r" ,
101
102
)
102
103
@@ -109,7 +110,7 @@ def test_helpers(tmpdir, store):
109
110
metadata .units ,
110
111
chunk_shape ,
111
112
chunk_shape ,
112
- dtype = np . float32 ,
113
+ dtype = dtype ,
113
114
mode = "w" ,
114
115
)
115
116
assert array .roi == Roi (
@@ -129,7 +130,7 @@ def test_helpers(tmpdir, store):
129
130
metadata .units ,
130
131
chunk_shape ,
131
132
chunk_shape ,
132
- dtype = np . float32 ,
133
+ dtype = dtype ,
133
134
mode = "r+" ,
134
135
)
135
136
assert array .roi == Roi (
@@ -149,7 +150,7 @@ def test_helpers(tmpdir, store):
149
150
metadata .units ,
150
151
chunk_shape ,
151
152
chunk_shape ,
152
- dtype = np . float32 ,
153
+ dtype = dtype ,
153
154
mode = "a" ,
154
155
)
155
156
assert array .roi == Roi (
@@ -162,7 +163,7 @@ def test_helpers(tmpdir, store):
162
163
163
164
# test prepare_ds with mode "w" overwrites existing array even if compatible
164
165
array [:] = 2
165
- assert np .all (np .isclose (array [:], np . ones ( chunk_shape ) * 2 ))
166
+ assert np .all (np .isclose (array [:], 2 ))
166
167
array = prepare_ds (
167
168
store ,
168
169
metadata .offset ,
@@ -171,10 +172,10 @@ def test_helpers(tmpdir, store):
171
172
metadata .units ,
172
173
chunk_shape ,
173
174
chunk_shape ,
174
- dtype = np . float32 ,
175
+ dtype = dtype ,
175
176
mode = "w" ,
176
177
)
177
- assert np .all (np .isclose (array [:], np . ones ( chunk_shape ) * 0 ))
178
+ assert np .all (np .isclose (array [:], 0 ))
178
179
assert array .roi == Roi (
179
180
metadata .offset , metadata .voxel_size * Coordinate (* chunk_shape [- 3 :])
180
181
)
0 commit comments