Skip to content

Commit 36a1966

Browse files
committed
Fix v2 test
1 parent a022d77 commit 36a1966

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

tests/test_v2.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,8 @@ def test_create_array_defaults(store: Store):
194194
)
195195

196196

197-
@pytest.mark.parametrize("array_order", ["C", "F"])
198-
@pytest.mark.parametrize("data_order", ["C", "F"])
199-
@pytest.mark.parametrize("memory_order", ["C", "F"])
200-
def test_v2_non_contiguous(
201-
array_order: Literal["C", "F"], data_order: Literal["C", "F"], memory_order: Literal["C", "F"]
202-
) -> None:
197+
@pytest.mark.parametrize("order", ["C", "F"])
198+
def test_v2_non_contiguous(order: Literal["C", "F"]) -> None:
203199
store = MemoryStore()
204200
arr = zarr.create_array(
205201
store,
@@ -211,22 +207,21 @@ def test_v2_non_contiguous(
211207
filters=None,
212208
compressors=None,
213209
overwrite=True,
214-
order=array_order,
215-
config={"order": memory_order},
210+
order=order,
216211
)
217212

218213
# Non-contiguous write
219-
a = np.arange(arr.shape[0] * arr.shape[1]).reshape(arr.shape, order=data_order)
214+
a = np.arange(arr.shape[0] * arr.shape[1]).reshape(arr.shape, order=order)
220215
arr[6:9, 3:6] = a[6:9, 3:6] # The slice on the RHS is important
221216
np.testing.assert_array_equal(arr[6:9, 3:6], a[6:9, 3:6])
222217

223218
np.testing.assert_array_equal(
224219
a[6:9, 3:6],
225220
np.frombuffer(
226221
sync(store.get("2.1", default_buffer_prototype())).to_bytes(), dtype="float64"
227-
).reshape((3, 3), order=array_order),
222+
).reshape((3, 3), order=order),
228223
)
229-
if memory_order == "F":
224+
if order == "F":
230225
assert (arr[6:9, 3:6]).flags.f_contiguous
231226
else:
232227
assert (arr[6:9, 3:6]).flags.c_contiguous
@@ -242,13 +237,12 @@ def test_v2_non_contiguous(
242237
compressors=None,
243238
filters=None,
244239
overwrite=True,
245-
order=array_order,
246-
config={"order": memory_order},
240+
order=order,
247241
)
248242

249243
# Contiguous write
250-
a = np.arange(9).reshape((3, 3), order=data_order)
251-
if data_order == "F":
244+
a = np.arange(9).reshape((3, 3), order=order)
245+
if order == "F":
252246
assert a.flags.f_contiguous
253247
else:
254248
assert a.flags.c_contiguous

0 commit comments

Comments
 (0)