summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_extras.py
diff options
context:
space:
mode:
authorLoïc Estève <loic.esteve@ymail.com>2016-09-07 13:58:59 +0200
committerLoïc Estève <loic.esteve@ymail.com>2016-09-07 19:09:30 +0200
commited300480512029be7fbd031251a280964341acfe (patch)
tree3ffc66bd5b44c780ed539bc47473408962b6bfb8 /numpy/ma/tests/test_extras.py
parent96025b94ba3e7e38188de2bc224cde8df2ef5476 (diff)
downloadnumpy-ed300480512029be7fbd031251a280964341acfe.tar.gz
BUG: fix np.ma.median with only one non-masked value
and an axis argument. Add test.
Diffstat (limited to 'numpy/ma/tests/test_extras.py')
-rw-r--r--numpy/ma/tests/test_extras.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index 27fac3d63..0a6de4eba 100644
--- a/numpy/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -790,6 +790,15 @@ class TestMedian(TestCase):
assert_equal(r, out)
assert_(type(r) == MaskedArray)
+ def test_single_non_masked_value_on_axis(self):
+ data = [[1., 0.],
+ [0., 3.],
+ [0., 0.]]
+ masked_arr = np.ma.masked_equal(data, 0)
+ expected = [1., 3.]
+ assert_array_equal(np.ma.median(masked_arr, axis=0),
+ expected)
+
class TestCov(TestCase):