Commit 5329ccaa authored by Michiel Cottaar's avatar Michiel Cottaar Committed by Paul McCarthy
Browse files

BUG: actually test the stated bug

I think these tests would have failed before refactoring
parent 3322e68a
......@@ -25,3 +25,12 @@ def test_get_variables():
assert {'subject': '01', 'session': 'A'} == utils.extract_variables('sub-{subject}/[ses-{session}]/T1w.nii.gz', 'sub-01/ses-A/T1w.nii.gz')
with pytest.raises(ValueError):
utils.extract_variables('sub-{subject}/[ses-{session}]/T1w.nii.gz', 'sub-01/other/T1w.nii.gz')
def test_multiple_optionals():
with pytest.raises(KeyError):
utils.extract_variables('{var}[_{opt1}][_{opt2}]', 'test_foo')
assert {'var': 'test', 'opt1': None, 'opt2': None} == utils.extract_variables('{var}[_{opt1}][_{opt2}]', 'test')
assert {'var': 'test', 'opt1': 'oo', 'opt2': None} == utils.extract_variables('{var}[_f{opt1}][_{opt2}]', 'test_foo')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment