@@ -340,13 +340,13 @@ def delete_array_using_del(self, data: DataObject) -> None:
340340 self .all_arrays .remove (array_path )
341341
342342 @precondition (lambda self : self .store .supports_deletes )
343- @precondition (lambda self : len (self .all_groups ) >= 2 ) # fixme don't delete root
343+ @precondition (lambda self : bool (self .all_groups ))
344344 @rule (data = st .data ())
345345 def delete_group_using_del (self , data : DataObject ) -> None :
346- # ensure that we don't include the root group in the list of member names that we try
347- # to delete
348- member_names = tuple ( filter ( lambda v : "/" in v , sorted ( self . all_groups )))
349- group_path = data . draw ( st . sampled_from ( member_names ), label = "Group deletion target" )
346+ group_path = data . draw (
347+ st . sampled_from ( sorted ( self . all_groups )),
348+ label = "Group deletion target" ,
349+ )
350350 prefix , group_name = split_prefix_name (group_path )
351351 note (f"Deleting group '{ group_path = !r} ', { prefix = !r} , { group_name = !r} using delete" )
352352 members = zarr .open_group (store = self .model , path = group_path ).members (max_depth = None )
@@ -359,9 +359,7 @@ def delete_group_using_del(self, data: DataObject) -> None:
359359 group = zarr .open_group (store = store , path = prefix )
360360 group [group_name ] # check that it exists
361361 del group [group_name ]
362- if group_path != "/" :
363- # The root group is always present
364- self .all_groups .remove (group_path )
362+ self .all_groups .remove (group_path )
365363
366364 # # --------------- assertions -----------------
367365 # def check_group_arrays(self, group):
0 commit comments