-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert prefs dict to a class for futureproofing
- Loading branch information
Showing
3 changed files
with
111 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
from nltools.prefs import MNI_Template | ||
from nltools.data import Brain_Data | ||
import pytest | ||
|
||
|
||
def test_change_mni_resolution(): | ||
assert MNI_Template["resolution"] == "2mm" | ||
|
||
# Defaults | ||
brain = Brain_Data() | ||
assert brain.mask.affine[1, 1] == 2.0 | ||
assert MNI_Template["resolution"] == "2mm" | ||
|
||
# -> 3mm | ||
MNI_Template["resolution"] = "3mm" | ||
new_brain = Brain_Data() | ||
assert new_brain.mask.affine[1, 1] == 3.0 | ||
|
||
# switch back and test attribute setting | ||
MNI_Template.resolution = 2.0 # floats are cool | ||
assert MNI_Template["resolution"] == "2mm" | ||
|
||
newer_brain = Brain_Data() | ||
assert newer_brain.mask.affine[1, 1] == 2.0 | ||
|
||
with pytest.raises(NotImplementedError): | ||
MNI_Template.resolution = 1 |