|
41 | 41 | from zarr.core.buffer import NDArrayLike, NDArrayLikeOrScalar, default_buffer_prototype
|
42 | 42 | from zarr.core.chunk_grids import _auto_partition
|
43 | 43 | from zarr.core.chunk_key_encodings import ChunkKeyEncodingParams
|
44 |
| -from zarr.core.common import JSON, MemoryOrder, ZarrFormat |
| 44 | +from zarr.core.common import JSON, ZarrFormat |
45 | 45 | from zarr.core.dtype import (
|
46 | 46 | DateTime64,
|
47 | 47 | Float32,
|
|
61 | 61 | from zarr.core.group import AsyncGroup
|
62 | 62 | from zarr.core.indexing import BasicIndexer, ceildiv
|
63 | 63 | from zarr.core.metadata.v2 import ArrayV2Metadata
|
| 64 | +from zarr.core.metadata.v3 import ArrayV3Metadata |
64 | 65 | from zarr.core.sync import sync
|
65 | 66 | from zarr.errors import ContainsArrayError, ContainsGroupError
|
66 | 67 | from zarr.storage import LocalStore, MemoryStore, StorePath
|
67 | 68 |
|
68 | 69 | from .test_dtype.conftest import zdtype_examples
|
69 | 70 |
|
70 | 71 | if TYPE_CHECKING:
|
71 |
| - from zarr.core.array_spec import ArrayConfigLike |
72 | 72 | from zarr.core.metadata.v3 import ArrayV3Metadata
|
73 | 73 |
|
74 | 74 |
|
@@ -1447,52 +1447,6 @@ async def test_data_ignored_params(store: Store) -> None:
|
1447 | 1447 | ):
|
1448 | 1448 | await create_array(store, data=data, shape=None, dtype=data.dtype, overwrite=True)
|
1449 | 1449 |
|
1450 |
| - @staticmethod |
1451 |
| - @pytest.mark.parametrize("order", ["C", "F", None]) |
1452 |
| - @pytest.mark.parametrize("with_config", [True, False]) |
1453 |
| - def test_order( |
1454 |
| - order: MemoryOrder | None, |
1455 |
| - with_config: bool, |
1456 |
| - zarr_format: ZarrFormat, |
1457 |
| - store: MemoryStore, |
1458 |
| - ) -> None: |
1459 |
| - """ |
1460 |
| - Test that the arrays generated by array indexing have a memory order defined by the config order |
1461 |
| - value, and that for zarr v2 arrays, the ``order`` field in the array metadata is set correctly. |
1462 |
| - """ |
1463 |
| - config: ArrayConfigLike | None = {} |
1464 |
| - if order is None: |
1465 |
| - config = {} |
1466 |
| - expected = zarr.config.get("array.order") |
1467 |
| - else: |
1468 |
| - config = {"order": order} |
1469 |
| - expected = order |
1470 |
| - |
1471 |
| - if not with_config: |
1472 |
| - # Test without passing config parameter |
1473 |
| - config = None |
1474 |
| - |
1475 |
| - arr = zarr.create_array( |
1476 |
| - store=store, |
1477 |
| - shape=(2, 2), |
1478 |
| - zarr_format=zarr_format, |
1479 |
| - dtype="i4", |
1480 |
| - order=order, |
1481 |
| - config=config, |
1482 |
| - ) |
1483 |
| - assert arr.order == expected |
1484 |
| - if zarr_format == 2: |
1485 |
| - assert arr.metadata.zarr_format == 2 |
1486 |
| - assert arr.metadata.order == expected |
1487 |
| - |
1488 |
| - vals = np.asarray(arr) |
1489 |
| - if expected == "C": |
1490 |
| - assert vals.flags.c_contiguous |
1491 |
| - elif expected == "F": |
1492 |
| - assert vals.flags.f_contiguous |
1493 |
| - else: |
1494 |
| - raise AssertionError |
1495 |
| - |
1496 | 1450 | @staticmethod
|
1497 | 1451 | @pytest.mark.parametrize("write_empty_chunks", [True, False])
|
1498 | 1452 | async def test_write_empty_chunks_config(write_empty_chunks: bool, store: Store) -> None:
|
@@ -1674,6 +1628,15 @@ async def test_from_array_arraylike(
|
1674 | 1628 | np.testing.assert_array_equal(result[...], np.full_like(src, fill_value))
|
1675 | 1629 |
|
1676 | 1630 |
|
| 1631 | +def test_from_array_F_order() -> None: |
| 1632 | + arr = zarr.create_array(store={}, data=np.array([1]), order="F", zarr_format=2) |
| 1633 | + with pytest.warns( |
| 1634 | + UserWarning, |
| 1635 | + match="The existing order='F' of the source Zarr format 2 array will be ignored.", |
| 1636 | + ): |
| 1637 | + zarr.from_array(store={}, data=arr, zarr_format=3) |
| 1638 | + |
| 1639 | + |
1677 | 1640 | async def test_orthogonal_set_total_slice() -> None:
|
1678 | 1641 | """Ensure that a whole chunk overwrite does not read chunks"""
|
1679 | 1642 | store = MemoryStore()
|
|
0 commit comments