summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_nanfunctions.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-04-22 18:31:32 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-04-22 18:31:32 -0600
commitd0b3f8f4213ee2d285be7d410a0cd7a1a601a7bd (patch)
tree91cba85428a9a9f7cdaae5971569d314944ec92d /numpy/lib/tests/test_nanfunctions.py
parentdd192e6ce7a99d1c24861d2875af18fced072ac9 (diff)
parentff459fd2dc3641486b35c672e0d48855669a13a5 (diff)
downloadnumpy-d0b3f8f4213ee2d285be7d410a0cd7a1a601a7bd.tar.gz
Merge pull request #4628 from mhvk/nanfunctions-copyto-call
BUG: incorrect argument order to _copyto in in np.nanmax, np.nanmin
Diffstat (limited to 'numpy/lib/tests/test_nanfunctions.py')
-rw-r--r--numpy/lib/tests/test_nanfunctions.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py
index df332dfb1..f00aa0165 100644
--- a/numpy/lib/tests/test_nanfunctions.py
+++ b/numpy/lib/tests/test_nanfunctions.py
@@ -114,6 +114,31 @@ class TestNanFunctions_MinMax(TestCase):
assert_(res.shape == (3, 1))
res = f(mat)
assert_(np.isscalar(res))
+ # check that rows of nan are dealt with for subclasses (#4628)
+ mat[1] = np.nan
+ for f in self.nanfuncs:
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always')
+ res = f(mat, axis=0)
+ assert_(isinstance(res, np.matrix))
+ assert_(not np.any(np.isnan(res)))
+ assert_(len(w) == 0)
+
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always')
+ res = f(mat, axis=1)
+ assert_(isinstance(res, np.matrix))
+ assert_(np.isnan(res[1, 0]) and not np.isnan(res[0, 0])
+ and not np.isnan(res[2, 0]))
+ assert_(len(w) == 1, 'no warning raised')
+ assert_(issubclass(w[0].category, RuntimeWarning))
+
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always')
+ res = f(mat)
+ assert_(np.isscalar(res))
+ assert_(res != np.nan)
+ assert_(len(w) == 0)
class TestNanFunctions_ArgminArgmax(TestCase):