Skip to content

Commit

Permalink
Add test to cover split sub / ses behaviour.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Jun 9, 2024
1 parent 84ed82f commit f1baa3e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/tests_integration/test_create_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,33 @@ def test_datetime_flag_in_session(self, project):
assert all([re.search(datetime_regexp, name) for name in ses_names])
assert all([tags("time") not in name for name in ses_names])

def test_created_paths_dict_sub_or_ses_only(self, project):
"""
Test that the `created_folders` dictionary returned by
`create_folders` correctly splits paths when only
subject or session is passed. The `datatype` case is
tested in `test_utils.check_folder_tree_is_correct()`.
"""
created_path_sub = project.create_folders("rawdata", "sub-001")

assert len(created_path_sub) == 2
assert created_path_sub["ses"] == []
assert (
created_path_sub["sub"][0]
== project.get_local_path() / "rawdata" / "sub-001"
)

created_path_ses = project.create_folders(
"rawdata", "sub-002", "ses-001"
)

assert len(created_path_ses) == 2
assert created_path_ses["sub"] == []
assert (
created_path_ses["ses"][0]
== project.get_local_path() / "rawdata" / "sub-002" / "ses-001"
)

# ----------------------------------------------------------------------------------------------------------
# Test Make Folders in Different Top Level Folders
# ----------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit f1baa3e

Please sign in to comment.