(self)
| 4014 | |
| 4015 | @requires_dask |
| 4016 | def test_region_write(self) -> None: |
| 4017 | ds = Dataset({"foo": ("x", [1, 2, 3])}, coords={"x": [1, 2, 3]}).chunk() |
| 4018 | with self.create_zarr_target() as store: |
| 4019 | if has_zarr_v3: |
| 4020 | expected = { |
| 4021 | "set": 5, |
| 4022 | "get": 2, |
| 4023 | "list_dir": 2, |
| 4024 | "list_prefix": 4, |
| 4025 | } |
| 4026 | else: |
| 4027 | expected = { |
| 4028 | "iter": 1, |
| 4029 | "contains": 16, |
| 4030 | "setitem": 9, |
| 4031 | "getitem": 13, |
| 4032 | "listdir": 0, |
| 4033 | "list_prefix": 5, |
| 4034 | } |
| 4035 | |
| 4036 | patches = self.make_patches(store) |
| 4037 | with patch.multiple(KVStore, **patches): |
| 4038 | ds.to_zarr(store, mode="w", compute=False) |
| 4039 | self.check_requests(expected, patches) |
| 4040 | |
| 4041 | # v2024.03.0: {'iter': 5, 'contains': 2, 'setitem': 1, 'getitem': 6, 'listdir': 5, 'list_prefix': 0} |
| 4042 | # 6057128b: {'iter': 4, 'contains': 2, 'setitem': 1, 'getitem': 5, 'listdir': 4, 'list_prefix': 0} |
| 4043 | if has_zarr_v3: |
| 4044 | expected = { |
| 4045 | "set": 1, |
| 4046 | "get": 3, |
| 4047 | "list_dir": 0, |
| 4048 | "list_prefix": 0, |
| 4049 | } |
| 4050 | else: |
| 4051 | expected = { |
| 4052 | "iter": 1, |
| 4053 | "contains": 6, |
| 4054 | "setitem": 1, |
| 4055 | "getitem": 7, |
| 4056 | "listdir": 0, |
| 4057 | "list_prefix": 0, |
| 4058 | } |
| 4059 | |
| 4060 | patches = self.make_patches(store) |
| 4061 | with patch.multiple(KVStore, **patches): |
| 4062 | ds.to_zarr(store, region={"x": slice(None)}) |
| 4063 | self.check_requests(expected, patches) |
| 4064 | |
| 4065 | # v2024.03.0: {'iter': 6, 'contains': 4, 'setitem': 1, 'getitem': 11, 'listdir': 6, 'list_prefix': 0} |
| 4066 | # 6057128b: {'iter': 4, 'contains': 2, 'setitem': 1, 'getitem': 7, 'listdir': 4, 'list_prefix': 0} |
| 4067 | if has_zarr_v3: |
| 4068 | expected = { |
| 4069 | "set": 1, |
| 4070 | "get": 4, |
| 4071 | "list_dir": 0, |
| 4072 | "list_prefix": 0, |
| 4073 | } |
nothing calls this directly
no test coverage detected