[Numpy-svn] r3268 - in trunk/numpy: core/tests lib/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Oct 6 13:56:52 CDT 2006


Author: stefan
Date: 2006-10-06 13:56:24 -0500 (Fri, 06 Oct 2006)
New Revision: 3268

Modified:
   trunk/numpy/core/tests/test_regression.py
   trunk/numpy/lib/tests/test_polynomial.py
Log:
Add tests for tickets #312, #322, for polynomial roots and for setting
elements in object arrays.


Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2006-10-06 04:57:17 UTC (rev 3267)
+++ trunk/numpy/core/tests/test_regression.py	2006-10-06 18:56:24 UTC (rev 3268)
@@ -456,5 +456,25 @@
         lst = ['abc','cde','fgh']
         N.lexsort((lst,))
         
+    def check_recarray_copy(self, level=rlevel):
+        """Ticket #312"""
+        dt = [('x',N.int16),('y',N.float64)]
+        ra = N.array([(1,2.3)], dtype=dt)
+        rb = N.rec.array(ra, dtype=dt)
+        rb['x'] = 2.
+        assert ra['x'] != rb['x']
+        
+    def check_rec_fromarray(self, level=rlevel):
+        """Ticket #322"""
+        x1 = N.array([[1,2],[3,4],[5,6]])
+        x2 = N.array(['a','dd','xyz'])
+        x3 = N.array([1.1,2,3])
+        N.rec.fromarrays([x1,x2,x3], formats="(2,)i4,a3,f8")
+        
+    def check_object_array_assign(self, level=rlevel):
+        x = N.empty((2,2),object)
+        x.flat[2] = (1,2,3)
+        assert_equal(x.flat[2],(1,2,3))
+        
 if __name__ == "__main__":
     NumpyTest().run()

Modified: trunk/numpy/lib/tests/test_polynomial.py
===================================================================
--- trunk/numpy/lib/tests/test_polynomial.py	2006-10-06 04:57:17 UTC (rev 3267)
+++ trunk/numpy/lib/tests/test_polynomial.py	2006-10-06 18:56:24 UTC (rev 3268)
@@ -74,9 +74,13 @@
 """
 
 from numpy.testing import *
+import numpy as N
 
 class test_docs(NumpyTestCase):
     def check_doctests(self): return self.rundocs()
+    
+    def check_roots(self):
+        assert_array_equal(N.roots([1,0,0]), [0,0])
 
 if __name__ == "__main__":
     NumpyTest().run()



More information about the Numpy-svn mailing list