diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2014-03-18 19:03:42 +0100 |
---|---|---|
committer | Julian Taylor <juliantaylor108@gmail.com> | 2014-03-18 19:03:42 +0100 |
commit | 6b38cdd2c2543e3957a593c48628f1daf23d48a9 (patch) | |
tree | 0d8530d297b4d0021d94252287e5c231678a3a03 | |
parent | f38471792b73905eaf12b49112a712dd0ee9a358 (diff) | |
parent | 5df0158905289854700673ba5dee11982a70ab2b (diff) | |
download | numpy-6b38cdd2c2543e3957a593c48628f1daf23d48a9.tar.gz |
Merge pull request #4507 from juliantaylor/test-add
TST: add some more tests
-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) |