Skip to content

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

Merged
merged 3 commits into from
Oct 17, 2015
Merged

TST: Add GIFTI tests #355

merged 3 commits into from
Oct 17, 2015

Conversation

bcipolli
Copy link
Contributor

@bcipolli bcipolli commented Oct 9, 2015

This isn't complete, but add some basic smoke tests (at least print_summary shouldn't raise an error), that explicit errors are hit, and that non-None defaults are set by objects.

@bcipolli bcipolli changed the title Add GIFTI tests TST: Add GIFTI tests Oct 9, 2015
@bcipolli
Copy link
Contributor Author

@effigies besides the other two, I also rebased this one. Anything you'd like to see here? It's just adding a bit to test coverage.

@@ -453,7 +453,7 @@ def add_gifti_data_array(self, dataarr):
if isinstance(dataarr, GiftiDataArray):
self.darrays.append(dataarr)
else:
print("dataarr paramater must be of tzpe GiftiDataArray")
raise ValueError("dataarr paramater must be of type GiftiDataArray")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, while I'm critiquing, my preference on this idiom would be:

if not isinstance(...):
    raise TypeError(...)
self.darrays.append(dataarr)

Just associates the check more closely with the guarded case, and avoids visually demoting the useful code by putting it in an else block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 ValueErrors that should be TypeErrors. Tests running.

@bcipolli
Copy link
Contributor Author

@effigies I'm seeing an AppVeyor failure in this PR. I tried to follow it backwards to previous PRs, but none completed it. I also didn't reproduce on my local config. What's AppVeyor? And do we care? Previous PRs were merged without AppVeyor finishing.

Edit: appveyor failure is here:
https://ci.appveyor.com/project/Eric89GXL/nibabel/build/1.0.291/job/agd8kmqeimwu6io3#L793

@effigies
Copy link
Member

It does Windows builds, at least for nibabel. I left a note on #358. 32 bit builds are broken under numpy 1.10, I believe for floating point precision issues.

That's beyond my skill/time to resolve, so as long as that's the only error, I'm comfortable merging.

On October 17, 2015 8:33:16 AM EDT, Ben Cipollini [email protected] wrote:

@effigies I'm seeing an AppVeyor failure in this PR. I tried to follow
it backwards to previous PRs, but none completed it. I also didn't
reproduce on my local config. What's AppVeyor? And do we care? Previous
PRs were merged without AppVeyor finishing.


Reply to this email directly or view it on GitHub:
#355 (comment)

Chris Markiewicz

else:
print("dataarr paramater must be of tzpe GiftiDataArray")
if not isinstance(dataarr, GiftiDataArray):
raise TypeError("dataarr paramater must be of type GiftiDataArray")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, how about "Not a valid GiftiDataArray instance"?

@effigies
Copy link
Member

Noting for posterity that although these ValueError => TypeError changes are API changes, the exceptions were introduced in the previous PR.

effigies added a commit that referenced this pull request Oct 17, 2015
TST: Add GIFTI tests

RF: Raise TypeErrors on mistyped arguments
@effigies effigies merged commit 6fb4ea0 into nipy:master Oct 17, 2015
@bcipolli bcipolli deleted the gifti-addtests branch October 21, 2015 14:58
grlee77 pushed a commit to grlee77/nibabel that referenced this pull request Mar 15, 2016
TST: Add GIFTI tests

RF: Raise TypeErrors on mistyped arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants