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

numpy-svn@scip... numpy-svn@scip...
Fri Apr 25 02:24:53 CDT 2008


Author: charris
Date: 2008-04-25 02:24:51 -0500 (Fri, 25 Apr 2008)
New Revision: 5083

Modified:
   trunk/numpy/core/tests/test_multiarray.py
Log:
Add test for numeric type array creation from string values.


Modified: trunk/numpy/core/tests/test_multiarray.py
===================================================================
--- trunk/numpy/core/tests/test_multiarray.py	2008-04-25 06:03:18 UTC (rev 5082)
+++ trunk/numpy/core/tests/test_multiarray.py	2008-04-25 07:24:51 UTC (rev 5083)
@@ -4,6 +4,7 @@
 from numpy.testing import *
 from numpy.core import *
 
+
 class TestFlags(NumpyTestCase):
     def setUp(self):
         self.a = arange(10)
@@ -268,6 +269,14 @@
                 pass
         self.failUnlessRaises(ValueError, array, x())
 
+    def check_from_string(self) :
+        types = np.typecodes['AllInteger'] + np.typecodes['Float']
+        nstr = ['123','123']
+        result = array([123, 123], dtype=int)
+        for type in types :
+            msg = 'String conversion for %s' % type
+            assert_equal(array(nstr, dtype=type), result, err_msg=msg)
+
 class TestBool(NumpyTestCase):
     def check_test_interning(self):
         a0 = bool_(0)



More information about the Numpy-svn mailing list