|
6 | 6 | import pickle |
7 | 7 | import re |
8 | 8 | import sys |
| 9 | +from contextlib import nullcontext |
9 | 10 | from itertools import accumulate, starmap |
10 | 11 | from typing import TYPE_CHECKING, Any, Literal |
11 | 12 | from unittest import mock |
@@ -1073,13 +1074,21 @@ def test_auto_partition_auto_shards( |
1073 | 1074 | where there are 8 or more chunks. |
1074 | 1075 | """ |
1075 | 1076 | dtype = np.dtype("uint8") |
1076 | | - with zarr.config.set({"array.target_shard_size_bytes": target_shard_size_bytes}): |
1077 | | - auto_shards, _ = _auto_partition( |
1078 | | - array_shape=array_shape, |
1079 | | - chunk_shape=chunk_shape, |
1080 | | - shard_shape="auto", |
1081 | | - item_size=dtype.itemsize, |
| 1077 | + with ( |
| 1078 | + pytest.warns( |
| 1079 | + ZarrUserWarning, |
| 1080 | + match="Automatic shard shape inference is experimental and may change without notice.", |
1082 | 1081 | ) |
| 1082 | + if target_shard_size_bytes is None |
| 1083 | + else nullcontext() |
| 1084 | + ): |
| 1085 | + with zarr.config.set({"array.target_shard_size_bytes": target_shard_size_bytes}): |
| 1086 | + auto_shards, _ = _auto_partition( |
| 1087 | + array_shape=array_shape, |
| 1088 | + chunk_shape=chunk_shape, |
| 1089 | + shard_shape="auto", |
| 1090 | + item_size=dtype.itemsize, |
| 1091 | + ) |
1083 | 1092 | assert auto_shards == expected_shards |
1084 | 1093 |
|
1085 | 1094 |
|
|
0 commit comments