@@ -3401,8 +3401,8 @@ def test_append(self) -> None:
3401
3401
if has_zarr_v3 :
3402
3402
expected = {
3403
3403
"set" : 4 ,
3404
- "get" : 16 , # TODO: fixme upstream (should be 8)
3405
- "list_dir" : 3 , # TODO: fixme upstream (should be 2)
3404
+ "get" : 9 , # TODO: fixme upstream (should be 8)
3405
+ "list_dir" : 2 , # TODO: fixme upstream (should be 2)
3406
3406
"list_prefix" : 0 ,
3407
3407
}
3408
3408
else :
@@ -3424,8 +3424,8 @@ def test_append(self) -> None:
3424
3424
if has_zarr_v3 :
3425
3425
expected = {
3426
3426
"set" : 4 ,
3427
- "get" : 16 , # TODO: fixme upstream (should be 8)
3428
- "list_dir" : 3 , # TODO: fixme upstream (should be 2)
3427
+ "get" : 9 , # TODO: fixme upstream (should be 8)
3428
+ "list_dir" : 2 , # TODO: fixme upstream (should be 2)
3429
3429
"list_prefix" : 0 ,
3430
3430
}
3431
3431
else :
@@ -3479,7 +3479,7 @@ def test_region_write(self) -> None:
3479
3479
expected = {
3480
3480
"set" : 1 ,
3481
3481
"get" : 3 ,
3482
- "list_dir" : 2 ,
3482
+ "list_dir" : 0 ,
3483
3483
"list_prefix" : 0 ,
3484
3484
}
3485
3485
else :
@@ -3502,8 +3502,8 @@ def test_region_write(self) -> None:
3502
3502
if has_zarr_v3 :
3503
3503
expected = {
3504
3504
"set" : 1 ,
3505
- "get" : 5 ,
3506
- "list_dir" : 2 ,
3505
+ "get" : 4 ,
3506
+ "list_dir" : 0 ,
3507
3507
"list_prefix" : 0 ,
3508
3508
}
3509
3509
else :
@@ -3525,7 +3525,7 @@ def test_region_write(self) -> None:
3525
3525
expected = {
3526
3526
"set" : 0 ,
3527
3527
"get" : 5 ,
3528
- "list_dir" : 1 ,
3528
+ "list_dir" : 0 ,
3529
3529
"list_prefix" : 0 ,
3530
3530
}
3531
3531
else :
@@ -3567,13 +3567,26 @@ def create_zarr_target(self):
3567
3567
yield tmp
3568
3568
3569
3569
@contextlib .contextmanager
3570
- def create_store (self , cache_members : bool = False ):
3570
+ def create_store (self , ** kwargs ):
3571
3571
with self .create_zarr_target () as store_target :
3572
- group = backends .ZarrStore .open_group (
3573
- store_target , mode = "a" , cache_members = cache_members
3574
- )
3572
+ group = backends .ZarrStore .open_group (store_target , mode = "a" , ** kwargs )
3575
3573
yield group
3576
3574
3575
+ def test_write_store (self ) -> None :
3576
+ # This test is overriden from the base implementation because we need to ensure
3577
+ # that the members cache is off, as the `ZarrStore` instance is re-used in the
3578
+ # test function. Refactoring the base version of this test to
3579
+ # if this test is refactored to no longer re-use the store object, then
3580
+ # this implementation can be removed.
3581
+
3582
+ expected = create_test_data ()
3583
+ with self .create_store (cache_members = False ) as store :
3584
+ expected .dump_to_store (store )
3585
+ # we need to cf decode the store because it has time and
3586
+ # non-dimension coordinates
3587
+ with xr .decode_cf (store ) as actual :
3588
+ assert_allclose (expected , actual )
3589
+
3577
3590
3578
3591
@requires_zarr
3579
3592
class TestZarrWriteEmpty (TestZarrDirectoryStore ):
0 commit comments