@@ -211,70 +211,6 @@ def test_group_members(store: Store, zarr_format: ZarrFormat, consolidated_metad
211211 members_observed = group .members (max_depth = - 1 )
212212
213213
214- def test_group_members_2 (store : Store , zarr_format : ZarrFormat ) -> None :
215- """
216- Test that `Group.members` returns correct values, i.e. the arrays and groups
217- (explicit and implicit) contained in that group.
218- """
219- # group/
220- # subgroup/
221- # subsubgroup/
222- # subsubsubgroup
223- # subarray
224-
225- path = "group"
226- group = Group .from_store (
227- store = store ,
228- zarr_format = zarr_format ,
229- )
230- members_expected : dict [str , Array | Group ] = {}
231-
232- members_expected ["subgroup" ] = group .create_group ("subgroup" )
233- # make a sub-sub-subgroup, to ensure that the children calculation doesn't go
234- # too deep in the hierarchy
235- subsubgroup = members_expected ["subgroup" ].create_group ("subsubgroup" )
236- _ = subsubgroup .create_group ("subsubsubgroup" )
237-
238- members_expected ["subarray" ] = group .create_array (
239- "subarray" , shape = (100 ,), dtype = "uint8" , chunk_shape = (10 ,), overwrite = True
240- )
241-
242- # add an extra object to the domain of the group.
243- # the list of children should ignore this object.
244- sync (
245- store .set (
246- f"{ path } /extra_object-1" ,
247- default_buffer_prototype ().buffer .from_bytes (b"000000" ),
248- )
249- )
250- # add an extra object under a directory-like prefix in the domain of the group.
251- # this creates a directory with a random key in it
252- # this should not show up as a member
253- sync (
254- store .set (
255- f"{ path } /extra_directory/extra_object-2" ,
256- default_buffer_prototype ().buffer .from_bytes (b"000000" ),
257- )
258- )
259-
260- # this warning shows up when extra objects show up in the hierarchy
261- warn_context = pytest .warns (
262- UserWarning , match = r"Object at .* is not recognized as a component of a Zarr hierarchy."
263- )
264-
265- with warn_context :
266- members_observed = group .members ()
267- # members are not guaranteed to be ordered, so sort before comparing
268- assert sorted (dict (members_observed )) == sorted (members_expected )
269-
270- # partial
271- with warn_context :
272- members_observed = group .members (max_depth = 1 )
273- members_expected ["subgroup/subsubgroup" ] = subsubgroup
274- # members are not guaranteed to be ordered, so sort before comparing
275- assert sorted (dict (members_observed )) == sorted (members_expected )
276-
277-
278214def test_group (store : Store , zarr_format : ZarrFormat ) -> None :
279215 """
280216 Test basic Group routines.
0 commit comments