From 7d53c812d3e68ff28320ee7e32bc9816937b4142 Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Wed, 12 Mar 2014 20:44:14 +0100 Subject: MAINT: revert back to separate median implementation Merging median and percentile make would break astropy and quantities as we don't call mean anymore. These packages rely on overriding mean to add their own median behavior. --- numpy/lib/tests/test_function_base.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 27e7302ce..fcf89cb90 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1919,6 +1919,20 @@ class TestMedian(TestCase): assert_almost_equal(np.median(x2), 2) assert_allclose(np.median(x2, axis=0), x) + def test_subclass(self): + # gh-3846 + class MySubClass(np.ndarray): + def __new__(cls, input_array, info=None): + obj = np.asarray(input_array).view(cls) + obj.info = info + return obj + + def mean(self, axis=None, dtype=None, out=None): + return -7 + + a = MySubClass([1,2,3]) + assert_equal(np.median(a), -7) + def test_extended_axis(self): o = np.random.normal(size=(71, 23)) x = np.dstack([o] * 10) -- cgit v1.2.1