Skip to content
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

FIX: Raise value error if window data-type is unsupported #3944

Merged
merged 2 commits into from
Sep 2, 2014
Merged

FIX: Raise value error if window data-type is unsupported #3944

merged 2 commits into from
Sep 2, 2014

Conversation

venthur
Copy link
Contributor

@venthur venthur commented Aug 31, 2014

Added unittest. (I had to derive the Test class from unittest.TestCase to use
self.asserRaises. This had no effect on the other tests of this class as they
use numpys test assertions. The number of executed tests was unchanged.
Fixes #3603

Added unittest. (I had to derive the Test class from unittest.TestCase to use
self.asserRaises. This had no effect on the other tests of this class as they
use numpys test assertions. The number of executed tests was unchanged.
Fixes #3603
@ev-br
Copy link
Member

ev-br commented Aug 31, 2014

you can use

>>> from numpy.testing import assert_raises
>>> def f(x): return 1./x
>>> assert_raises(ZeroDivisionError, f, 0)
>>> >>> assert_raises(ZeroDivisionError, f, 1)
Traceback (most recent call last):
<snip>
AssertionError: ZeroDivisionError not raised

@ev-br ev-br added this to the 0.15.0 milestone Aug 31, 2014
@venthur
Copy link
Contributor Author

venthur commented Aug 31, 2014

Cool, thanks! (and fixed)

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a7c2677 on venthur:fix-3603 into * on scipy:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a7c2677 on venthur:fix-3603 into * on scipy:master*.

pv added a commit that referenced this pull request Sep 2, 2014
BUG: signal: Raise ValueError in get_window if window data-type is unsupported
@pv pv merged commit 1eb12db into scipy:master Sep 2, 2014
@pv
Copy link
Member

pv commented Sep 2, 2014

LGTM.

Doesn't fully fix gh-3603, however, as that requires changing:

 elif isinstance(window, ndarray) and window.shape == (Nx,):
      W = window

in signaltools.py:resample to something more sensible (move shape check inside if statement and raise an error if it fails).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing array as window into signal.resample() fails
4 participants