Skip to content

Commit 4adefa0

Browse files
committed
✅ Add tests for CPAC.qc.xcp.get_bids_info
1 parent ac31682 commit 4adefa0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

CPAC/qc/xcp.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,23 @@ def get_bids_info(subject, scan, wf_name):
323323
324324
run : str or int
325325
run ID
326+
327+
Examples
328+
--------
329+
>>> subject, session, task, run = get_bids_info(
330+
... subject='DavidBowman', scan='rest_acq-1_run-1',
331+
... wf_name='cpac_DavidBowman_3')
332+
>>> subject
333+
'DavidBowman'
334+
>>> 'session'
335+
'3'
336+
>>> task
337+
'rest'
338+
>>> run
339+
'1'
340+
>>> get_bids_info(subject='sub-colornest035', scan='rest_run-01',
341+
... wf_name='cpac_sub-colornest035_ses-1')
342+
('colornest035', '1', 'rest', '1')
326343
"""
327344
returns = ('subject', 'session', 'task', 'run')
328345
ses = wf_name.split('_')[-1]
@@ -351,7 +368,7 @@ def get_entity_part(key):
351368
returns[key] = get_entity_part(key)
352369
else:
353370
returns[key] = get_entity_part(key[:3])
354-
return tuple(returns.get(key) for key in [
371+
return tuple(str(returns.get(key)) for key in [
355372
'subject', 'session', 'task', 'run'])
356373

357374

0 commit comments

Comments
 (0)