Skip to content

Commit 3371dc4

Browse files
committed
Fix v2 test
1 parent 01a5554 commit 3371dc4

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
@@ -195,12 +195,8 @@ def test_create_array_defaults(store: Store):
195195
)
196196

197197

198-
@pytest.mark.parametrize("array_order", ["C", "F"])
199-
@pytest.mark.parametrize("data_order", ["C", "F"])
200-
@pytest.mark.parametrize("memory_order", ["C", "F"])
201-
def test_v2_non_contiguous(
202-
array_order: Literal["C", "F"], data_order: Literal["C", "F"], memory_order: Literal["C", "F"]
203-
) -> None:
198+
@pytest.mark.parametrize("order", ["C", "F"])
199+
def test_v2_non_contiguous(order: Literal["C", "F"]) -> None:
204200
store = MemoryStore()
205201
arr = zarr.create_array(
206202
store,
@@ -212,22 +208,21 @@ def test_v2_non_contiguous(
212208
filters=None,
213209
compressors=None,
214210
overwrite=True,
215-
order=array_order,
216-
config={"order": memory_order},
211+
order=order,
217212
)
218213

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

224219
np.testing.assert_array_equal(
225220
a[6:9, 3:6],
226221
np.frombuffer(
227222
sync(store.get("2.1", default_buffer_prototype())).to_bytes(), dtype="float64"
228-
).reshape((3, 3), order=array_order),
223+
).reshape((3, 3), order=order),
229224
)
230-
if memory_order == "F":
225+
if order == "F":
231226
assert (arr[6:9, 3:6]).flags.f_contiguous
232227
else:
233228
assert (arr[6:9, 3:6]).flags.c_contiguous
@@ -243,13 +238,12 @@ def test_v2_non_contiguous(
243238
compressors=None,
244239
filters=None,
245240
overwrite=True,
246-
order=array_order,
247-
config={"order": memory_order},
241+
order=order,
248242
)
249243

250244
# Contiguous write
251-
a = np.arange(9).reshape((3, 3), order=data_order)
252-
if data_order == "F":
245+
a = np.arange(9).reshape((3, 3), order=order)
246+
if order == "F":
253247
assert a.flags.f_contiguous
254248
else:
255249
assert a.flags.c_contiguous

0 commit comments

Comments
 (0)