-
Notifications
You must be signed in to change notification settings - Fork 262
TST: Add GIFTI tests #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TST: Add GIFTI tests #355
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,6 +155,7 @@ def rgba(self, rgba): | |
raise ValueError('rgba must be length 4.') | ||
self.red, self.green, self.blue, self.alpha = rgba | ||
|
||
|
||
def _arr2txt(arr, elem_fmt): | ||
arr = np.asarray(arr) | ||
assert arr.dtype.names is None | ||
|
@@ -404,7 +405,7 @@ def labeltable(self, labeltable): | |
|
||
""" | ||
if not isinstance(labeltable, GiftiLabelTable): | ||
raise ValueError("Not a valid GiftiLabelTable instance") | ||
raise TypeError("Not a valid GiftiLabelTable instance") | ||
self._labeltable = labeltable | ||
|
||
@np.deprecate_with_doc("Use the gifti_img.labeltable property instead.") | ||
|
@@ -432,7 +433,7 @@ def meta(self, meta): | |
None | ||
""" | ||
if not isinstance(meta, GiftiMetaData): | ||
raise ValueError("Not a valid GiftiMetaData instance") | ||
raise TypeError("Not a valid GiftiMetaData instance") | ||
self._meta = meta | ||
|
||
@np.deprecate_with_doc("Use the gifti_img.labeltable property instead.") | ||
|
@@ -450,10 +451,9 @@ def add_gifti_data_array(self, dataarr): | |
---------- | ||
dataarr : GiftiDataArray | ||
""" | ||
if isinstance(dataarr, GiftiDataArray): | ||
self.darrays.append(dataarr) | ||
else: | ||
print("dataarr paramater must be of tzpe GiftiDataArray") | ||
if not isinstance(dataarr, GiftiDataArray): | ||
raise TypeError("Not a valid GiftiDataArray instance") | ||
self.darrays.append(dataarr) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, while I'm critiquing, my preference on this idiom would be:
Just associates the check more closely with the guarded case, and avoids visually demoting the useful code by putting it in an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call on the style and error type. Fixed, and scrubbed the code for other |
||
def remove_gifti_data_array(self, ith): | ||
""" Removes the ith data array element from the GiftiImage """ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do a test for this exception, while we're at it.