[Numpy-svn] r8363 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Sun Apr 25 10:57:47 CDT 2010


Author: charris
Date: 2010-04-25 10:57:47 -0500 (Sun, 25 Apr 2010)
New Revision: 8363

Modified:
   trunk/numpy/core/tests/test_multiarray.py
Log:
ENH: Add some tests for ndarray.resize.

Modified: trunk/numpy/core/tests/test_multiarray.py
===================================================================
--- trunk/numpy/core/tests/test_multiarray.py	2010-04-25 15:11:00 UTC (rev 8362)
+++ trunk/numpy/core/tests/test_multiarray.py	2010-04-25 15:57:47 UTC (rev 8363)
@@ -1059,8 +1059,27 @@
         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):
     def test_field_rename(self):
         dt = np.dtype([('f',float),('i',int)])



More information about the Numpy-svn mailing list