13
13
from zarr import AsyncGroup
14
14
from zarr .api .asynchronous import (
15
15
consolidate_metadata ,
16
- group ,
16
+ create_group ,
17
17
open ,
18
18
open_consolidated ,
19
+ open_group ,
19
20
)
20
21
from zarr .core .buffer import cpu , default_buffer_prototype
21
22
from zarr .core .dtype import parse_dtype
32
33
33
34
@pytest .fixture
34
35
async def memory_store_with_hierarchy (memory_store : Store ) -> Store :
35
- g = await group (store = memory_store , attributes = {"foo" : "bar" })
36
+ g = await create_group (store = memory_store , attributes = {"foo" : "bar" })
36
37
dtype = "uint8"
37
38
await g .create_array (name = "air" , shape = (1 , 2 , 3 ), dtype = dtype )
38
39
await g .create_array (name = "lat" , shape = (1 ,), dtype = dtype )
@@ -212,7 +213,7 @@ async def test_consolidated(self, memory_store_with_hierarchy: Store) -> None:
212
213
]
213
214
214
215
def test_consolidated_sync (self , memory_store : Store ) -> None :
215
- g = zarr .api .synchronous .group (store = memory_store , attributes = {"foo" : "bar" })
216
+ g = zarr .api .synchronous .create_group (store = memory_store , attributes = {"foo" : "bar" })
216
217
dtype = "uint8"
217
218
g .create_array (name = "air" , shape = (1 , 2 , 3 ), dtype = dtype )
218
219
g .create_array (name = "lat" , shape = (1 ,), dtype = dtype )
@@ -300,7 +301,7 @@ def test_consolidated_sync(self, memory_store: Store) -> None:
300
301
assert group4 .metadata == expected
301
302
302
303
async def test_not_writable_raises (self , memory_store : zarr .storage .MemoryStore ) -> None :
303
- await group (store = memory_store , attributes = {"foo" : "bar" })
304
+ await create_group (store = memory_store , attributes = {"foo" : "bar" })
304
305
read_store = zarr .storage .MemoryStore (store_dict = memory_store ._store_dict , read_only = True )
305
306
with pytest .raises (ValueError , match = "does not support writing" ):
306
307
await consolidate_metadata (read_store )
@@ -485,7 +486,7 @@ async def test_to_dict_order(
485
486
self , memory_store : zarr .storage .MemoryStore , zarr_format : ZarrFormat
486
487
) -> None :
487
488
with zarr .config .set (default_zarr_format = zarr_format ):
488
- g = await group (store = memory_store )
489
+ g = await create_group (store = memory_store )
489
490
490
491
# Create groups in non-lexicographix order
491
492
dtype = "float32"
@@ -602,7 +603,7 @@ async def test_use_consolidated_false(
602
603
self , memory_store : zarr .storage .MemoryStore , zarr_format : ZarrFormat
603
604
) -> None :
604
605
with zarr .config .set (default_zarr_format = zarr_format ):
605
- g = await group (store = memory_store , attributes = {"foo" : "bar" })
606
+ g = await create_group (store = memory_store , attributes = {"foo" : "bar" })
606
607
await g .create_group (name = "a" )
607
608
608
609
# test a stale read
@@ -648,7 +649,7 @@ async def test_stale_child_metadata_ignored(
648
649
# https://github.com/zarr-developers/zarr-python/issues/2921
649
650
# When consolidating metadata, we should ignore any (possibly stale) metadata
650
651
# from previous consolidations, *including at child nodes*.
651
- root = await zarr .api .asynchronous .group (store = memory_store , zarr_format = 3 )
652
+ root = await zarr .api .asynchronous .create_group (store = memory_store , zarr_format = 3 )
652
653
await root .create_group ("foo" )
653
654
await zarr .api .asynchronous .consolidate_metadata (memory_store , path = "foo" )
654
655
await root .create_group ("foo/bar/spam" )
@@ -712,7 +713,7 @@ async def test_absolute_path_for_subgroup(self, memory_store: zarr.storage.Memor
712
713
async def test_consolidated_metadata_encodes_special_chars (
713
714
memory_store : Store , zarr_format : ZarrFormat , fill_value : float
714
715
) -> None :
715
- root = await group (store = memory_store , zarr_format = zarr_format )
716
+ root = await create_group (store = memory_store , zarr_format = zarr_format )
716
717
_time = await root .create_array ("time" , shape = (12 ,), dtype = np .float64 , fill_value = fill_value )
717
718
if zarr_format == 3 :
718
719
with pytest .warns (
@@ -723,7 +724,7 @@ async def test_consolidated_metadata_encodes_special_chars(
723
724
else :
724
725
await zarr .api .asynchronous .consolidate_metadata (memory_store )
725
726
726
- root = await group (store = memory_store , zarr_format = zarr_format )
727
+ root = await open_group (store = memory_store , zarr_format = zarr_format )
727
728
root_buffer = root .metadata .to_buffer_dict (default_buffer_prototype ())
728
729
729
730
if zarr_format == 2 :
0 commit comments