File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 22
33import contextlib
44import inspect
5+ import json
56import operator
67import pickle
78import re
5859
5960 from _pytest .compat import LEGACY_PATH
6061
62+ from zarr .core .buffer .core import Buffer
6163 from zarr .core .common import JSON , ZarrFormat
6264
6365
@@ -1400,6 +1402,21 @@ def test_open_mutable_mapping_sync():
14001402 assert isinstance (group .store_path .store , MemoryStore )
14011403
14021404
1405+ async def test_open_ambiguous_node ():
1406+ zarr_json_bytes = default_buffer_prototype ().buffer .from_bytes (
1407+ json .dumps ({"zarr_format" : 3 , "node_type" : "group" }).encode ("utf-8" )
1408+ )
1409+ zgroup_bytes = default_buffer_prototype ().buffer .from_bytes (
1410+ json .dumps ({"zarr_format" : 2 }).encode ("utf-8" )
1411+ )
1412+ store : dict [str , Buffer ] = {"zarr.json" : zarr_json_bytes , ".zgroup" : zgroup_bytes }
1413+ with pytest .warns (
1414+ ZarrUserWarning ,
1415+ match = r"Both zarr\.json \(Zarr format 3\) and \.zgroup \(Zarr format 2\) metadata objects exist at" ,
1416+ ):
1417+ await AsyncGroup .open (store , zarr_format = None )
1418+
1419+
14031420class TestConsolidated :
14041421 async def test_group_getitem_consolidated (self , store : Store ) -> None :
14051422 root = await AsyncGroup .from_store (store = store )
You can’t perform that action at this time.
0 commit comments