File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1
1
"""py.test configuration"""
2
2
from pathlib import Path
3
- import pytest
4
3
from tempfile import TemporaryDirectory
4
+ from pkg_resources import resource_filename
5
5
6
+ import pytest
6
7
7
8
FILES = (
8
9
'functional.nii' ,
@@ -32,3 +33,4 @@ def data_dir():
32
33
@pytest .fixture (autouse = True )
33
34
def set_namespace (doctest_namespace , data_dir ):
34
35
doctest_namespace ["data_dir" ] = data_dir
36
+ doctest_namespace ["test_data" ] = Path (resource_filename ("nibabies" , "tests/data" ))
Original file line number Diff line number Diff line change
1
+ CEREBELLUM_LEFT
2
+ 8 230 148 34 255
3
+ THALAMUS_LEFT
4
+ 10 0 118 14 255
5
+ CAUDATE_LEFT
6
+ 11 122 186 220 255
Original file line number Diff line number Diff line change @@ -232,14 +232,11 @@ def parse_roi_labels(label_file):
232
232
233
233
Return a list of structure names and label keys.
234
234
235
- Example
236
- -------
237
- CEREBELLUM_LEFT
238
- 8 230 148 34 255
239
- THALAMUS_LEFT
240
- 10 0 118 14 255
241
-
242
- TODO: Add unit test
235
+ >>> structs, ids = parse_roi_labels(test_data / "labelfile.txt")
236
+ >>> structs
237
+ '["CEREBELLUM_LEFT", "THALAMUS_LEFT", "CAUDATE_LEFT"]'
238
+ >>> ids
239
+ '[8, 10, 11]'
243
240
"""
244
241
245
242
with open (label_file ) as fp :
You can’t perform that action at this time.
0 commit comments