(self)
| 3933 | assert summary[k] <= expected[k], (k, summary) |
| 3934 | |
| 3935 | def test_append(self) -> None: |
| 3936 | original = Dataset({"foo": ("x", [1])}, coords={"x": [0]}) |
| 3937 | modified = Dataset({"foo": ("x", [2])}, coords={"x": [1]}) |
| 3938 | |
| 3939 | with self.create_zarr_target() as store: |
| 3940 | if has_zarr_v3: |
| 3941 | # TODO: verify these |
| 3942 | expected = { |
| 3943 | "set": 5, |
| 3944 | "get": 4, |
| 3945 | "list_dir": 2, |
| 3946 | "list_prefix": 1, |
| 3947 | } |
| 3948 | else: |
| 3949 | expected = { |
| 3950 | "iter": 1, |
| 3951 | "contains": 18, |
| 3952 | "setitem": 10, |
| 3953 | "getitem": 13, |
| 3954 | "listdir": 0, |
| 3955 | "list_prefix": 3, |
| 3956 | } |
| 3957 | |
| 3958 | patches = self.make_patches(store) |
| 3959 | with patch.multiple(KVStore, **patches): |
| 3960 | original.to_zarr(store) |
| 3961 | self.check_requests(expected, patches) |
| 3962 | |
| 3963 | patches = self.make_patches(store) |
| 3964 | # v2024.03.0: {'iter': 6, 'contains': 2, 'setitem': 5, 'getitem': 10, 'listdir': 6, 'list_prefix': 0} |
| 3965 | # 6057128b: {'iter': 5, 'contains': 2, 'setitem': 5, 'getitem': 10, "listdir": 5, "list_prefix": 0} |
| 3966 | if has_zarr_v3: |
| 3967 | expected = { |
| 3968 | "set": 4, |
| 3969 | "get": 9, # TODO: fixme upstream (should be 8) |
| 3970 | "list_dir": 2, # TODO: fixme upstream (should be 2) |
| 3971 | "list_prefix": 0, |
| 3972 | } |
| 3973 | else: |
| 3974 | expected = { |
| 3975 | "iter": 1, |
| 3976 | "contains": 11, |
| 3977 | "setitem": 6, |
| 3978 | "getitem": 15, |
| 3979 | "listdir": 0, |
| 3980 | "list_prefix": 1, |
| 3981 | } |
| 3982 | |
| 3983 | with patch.multiple(KVStore, **patches): |
| 3984 | modified.to_zarr(store, mode="a", append_dim="x") |
| 3985 | self.check_requests(expected, patches) |
| 3986 | |
| 3987 | patches = self.make_patches(store) |
| 3988 | |
| 3989 | if has_zarr_v3: |
| 3990 | expected = { |
| 3991 | "set": 4, |
| 3992 | "get": 9, # TODO: fixme upstream (should be 8) |
nothing calls this directly
no test coverage detected