diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_regression.py | 8 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index 7a295d79c..e4feff372 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -1964,6 +1964,14 @@ class TestRegression(TestCase): self.assertTrue(arr is not arr_cp) self.assertTrue(isinstance(arr_cp, type(arr))) + def test_bool_subscript_crash(self): + # gh-4494 + c = np.rec.array([(1, 2, 3), (4, 5, 6)]) + masked = c[np.array([True, False])] + base = masked.base + del masked, c + base.dtype + if __name__ == "__main__": run_module_suite() diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index fcf89cb90..9a26ce5a3 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1860,6 +1860,10 @@ class TestMedian(TestCase): assert_equal(a[0], np.median(a)) a = np.array([0.0444502, 0.141249, 0.0463301]) assert_equal(a[-1], np.median(a)) + # check array scalar result + assert_equal(np.median(a).ndim, 0) + a[1] = np.nan + assert_equal(np.median(a).ndim, 0) def test_axis_keyword(self): a3 = np.array([[2, 3], @@ -1933,6 +1937,12 @@ class TestMedian(TestCase): a = MySubClass([1,2,3]) assert_equal(np.median(a), -7) + def test_object(self): + o = np.arange(7.); + assert_(type(np.median(o.astype(object))), float) + o[2] = np.nan + assert_(type(np.median(o.astype(object))), float) + def test_extended_axis(self): o = np.random.normal(size=(71, 23)) x = np.dstack([o] * 10) |