-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from oesteban/fix/test-template-names-early
FIX: Check template identifiers are valid early
- Loading branch information
Showing
10 changed files
with
66 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""Test the output-spaces parser.""" | ||
from collections import OrderedDict | ||
import pytest | ||
from .. import utils as u | ||
|
||
|
||
TEST_TEMPLATES = ( | ||
'MNI152NLin2009cAsym', | ||
'MNIInfant', | ||
'MNI152NLin6Asym', | ||
) | ||
|
||
|
||
def test_output_spaces(monkeypatch): | ||
"""Check the --output-spaces argument parser.""" | ||
with monkeypatch.context() as m: | ||
m.setattr(u, '_TF_TEMPLATES', TEST_TEMPLATES) | ||
assert u.output_space('MNI152NLin2009cAsym') == ('MNI152NLin2009cAsym', {}) | ||
assert u.output_space('MNI152NLin2009cAsym:native') == \ | ||
('MNI152NLin2009cAsym', {'native': True}) | ||
assert u.output_space('MNI152NLin2009cAsym:res-2') == \ | ||
('MNI152NLin2009cAsym', {'res': '2'}) | ||
assert u.output_space('MNIInfant:res-2:cohort-1') == \ | ||
('MNIInfant', {'res': '2', 'cohort': '1'}) | ||
|
||
with pytest.raises(ValueError): | ||
u.output_space('UnkownTemplate') | ||
|
||
|
||
def test_template_parser(monkeypatch): | ||
"""Check the --output-spaces argument parser.""" | ||
with monkeypatch.context() as m: | ||
m.setattr(u, '_TF_TEMPLATES', TEST_TEMPLATES) | ||
|
||
assert list(u._template(['MNI152NLin2009cAsym']).keys()) == ['MNI152NLin2009cAsym'] | ||
assert u._template(['MNI152NLin2009cAsym', 'MNI152NLin2009cAsym:res-2']) == \ | ||
OrderedDict([('MNI152NLin2009cAsym', {})]) | ||
|
||
assert u._template(['MNI152NLin2009cAsym', 'MNI152NLin2009cAsym:res-2', | ||
'MNI152NLin6Asym:res-2', 'MNI152NLin6Asym']) == \ | ||
OrderedDict([('MNI152NLin2009cAsym', {}), ('MNI152NLin6Asym', {'res': '2'})]) | ||
|
||
with pytest.raises(ValueError): | ||
u._template(['MNI152NLin6Asym:res-2', 'UnkownTemplate:res-2']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""sMRIPrep settings.""" | ||
from templateflow.api import templates as _get_templates | ||
|
||
TF_TEMPLATES = tuple(_get_templates()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +0,0 @@ | ||
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | ||
# vi: set ft=python sts=4 ts=4 sw=4 et: | ||
|
||
from .anatomical import init_anat_preproc_wf | ||
|
||
__all__ = ['init_anat_preproc_wf'] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters