|
| 1 | +# AUTO-GENERATED by tools/checkspecs.py on 2017.04.21 |
| 2 | +# Modified 2017.04.21 by Chris Markiewicz |
| 3 | +from __future__ import unicode_literals |
| 4 | +import pytest |
| 5 | + |
| 6 | +from ..base import FSSurfaceCommand |
| 7 | +from ... import freesurfer as fs |
| 8 | +from ...io import FreeSurferSource |
| 9 | + |
| 10 | + |
| 11 | +def test_FSSurfaceCommand_inputs(): |
| 12 | + input_map = dict(args=dict(argstr='%s', |
| 13 | + ), |
| 14 | + environ=dict(nohash=True, |
| 15 | + usedefault=True, |
| 16 | + ), |
| 17 | + ignore_exception=dict(nohash=True, |
| 18 | + usedefault=True, |
| 19 | + ), |
| 20 | + subjects_dir=dict(), |
| 21 | + terminal_output=dict(nohash=True, |
| 22 | + ), |
| 23 | + ) |
| 24 | + inputs = FSSurfaceCommand.input_spec() |
| 25 | + |
| 26 | + for key, metadata in list(input_map.items()): |
| 27 | + for metakey, value in list(metadata.items()): |
| 28 | + assert getattr(inputs.traits()[key], metakey) == value |
| 29 | + |
| 30 | + |
| 31 | +@pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") |
| 32 | +def test_associated_file(): |
| 33 | + fssrc = FreeSurferSource(subjects_dir=fs.Info.subjectsdir(), |
| 34 | + subject_id='fsaverage', hemi='lh') |
| 35 | + |
| 36 | + fsavginfo = fssrc.run().outputs.get() |
| 37 | + |
| 38 | + # Pairs of white/pial files in the same directories |
| 39 | + for white, pial in [('lh.white', 'lh.pial'), |
| 40 | + ('./lh.white', './lh.pial'), |
| 41 | + (fsavginfo['white'], fsavginfo['pial'])]: |
| 42 | + |
| 43 | + # Unspecified paths, possibly with missing hemisphere information, |
| 44 | + # are equivalent to using the same directory and hemisphere |
| 45 | + for name in ('pial', 'lh.pial', pial): |
| 46 | + assert FSSurfaceCommand._associated_file(white, name) == pial |
| 47 | + |
| 48 | + # With path information, no changes are made |
| 49 | + for name in ('./pial', './lh.pial', fsavginfo['pial']): |
| 50 | + assert FSSurfaceCommand._associated_file(white, name) == name |
0 commit comments