Skip to content

Commit

Permalink
test: update test cases + fix object creation
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Jan 17, 2024
1 parent 78495c6 commit 8190b52
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class MODO:
# List identifiers of samples in the archive
>>> demo.list_samples()
['/ex/demo-assay/demo1/bac1']
['/ex/assay1/sample1']
# List files in the archive
>>> sorted([file.name for file in demo.list_files()])
['demo1.cram', 'demo2.cram']
['demo1.cram', 'reference.fa']
"""

Expand Down Expand Up @@ -155,7 +155,7 @@ def remove_element(self, element_id: str):

def add_element(
self,
element: model.DataEntity | model.Sample | model.Assay,
element: model.DataEntity | model.Sample | model.Assay | model.MODO,
data_file: Optional[Path] = None,
part_of: Optional[str] = None,
):
Expand All @@ -171,7 +171,12 @@ def add_element(

# Link element to parent element
if part_of is None:
parent_path = next(self.archive.groups())[0]
try:
parent_path = next(self.archive.groups())[0]
# Empty iterator when initiating a MODO object
# Then the root group is MODO's id
except StopIteration:
parent_path = "/"
else:
parent_path = part_of

Expand Down

0 comments on commit 8190b52

Please sign in to comment.