diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2010-04-25 15:57:47 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-04-25 15:57:47 +0000 |
commit | 82e08aa07fa4d6a94808f8cf7cd191d1bf6bae82 (patch) | |
tree | 7d66772a7597d00fa983d77c66b94d855bec4564 /numpy | |
parent | b4b4829dd5daa525f21ac733240b80e5a159bffa (diff) | |
download | numpy-82e08aa07fa4d6a94808f8cf7cd191d1bf6bae82.tar.gz |
ENH: Add some tests for ndarray.resize.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 89d180a2f..b8ea0a240 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -1059,6 +1059,25 @@ class TestResize(TestCase): x = np.eye(3) x.resize(None) assert_array_equal(x, np.eye(3)) + x.resize() + assert_array_equal(x, np.eye(3)) + + def test_invalid_arguements(self): + self.assertRaises(TypeError, np.eye(3).resize, 'hi') + self.assertRaises(ValueError, np.eye(3).resize, -1) + self.assertRaises(TypeError, np.eye(3).resize, order=1) + self.assertRaises(TypeError, np.eye(3).resize, refcheck='hi') + + def test_freeform_shape(self): + x = np.eye(3) + x.resize(3,2,1) + assert_(x.shape == (3,2,1)) + + def test_zeros_appended(self): + x = np.eye(3) + x.resize(2,3,3) + assert_array_equal(x[0], np.eye(3)) + assert_array_equal(x[1], np.zeros((3,3))) class TestRecord(TestCase): |