diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-03-12 20:44:14 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-03-13 21:10:31 +0100 |
commit | 7d53c812d3e68ff28320ee7e32bc9816937b4142 (patch) | |
tree | 8906807748186d9d5217a15656cc01059dacf3bc /numpy/lib/tests/test_function_base.py | |
parent | eea1a9c49024c18fda3ad9782dee3956492cfa1a (diff) | |
download | numpy-7d53c812d3e68ff28320ee7e32bc9816937b4142.tar.gz |
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.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 14 |
1 files changed, 14 insertions, 0 deletions
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) |