[Numpy-svn] r8142 - in trunk: numpy/core/tests tools

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 12:06:53 CST 2010


Author: ptvirtan
Date: 2010-02-20 12:06:53 -0600 (Sat, 20 Feb 2010)
New Revision: 8142

Modified:
   trunk/numpy/core/tests/test_defchararray.py
   trunk/tools/py3tool.py
Log:
3K: BUG: make test_defchararray convert properly via 2to3

Modified: trunk/numpy/core/tests/test_defchararray.py
===================================================================
--- trunk/numpy/core/tests/test_defchararray.py	2010-02-20 18:06:35 UTC (rev 8141)
+++ trunk/numpy/core/tests/test_defchararray.py	2010-02-20 18:06:53 UTC (rev 8142)
@@ -4,6 +4,9 @@
 import sys
 from numpy.core.multiarray import _vec_string
 
+kw_unicode_true = {'unicode': True}
+kw_unicode_false = {'unicode': False}
+
 class TestBasic(TestCase):
     def test_from_object_array(self):
         A = np.array([['abc', 2],
@@ -16,7 +19,7 @@
         A = np.array([['abc', u'Sigma \u03a3'],
                       ['long   ', '0123456789']], dtype='O')
         self.failUnlessRaises(ValueError, np.char.array, (A,))
-        B = np.char.array(A, unicode=True)
+        B = np.char.array(A, **kw_unicode_true)
         assert_equal(B.dtype.itemsize, 10 * np.array('a', 'U').dtype.itemsize)
         assert_array_equal(B, [['abc', u'Sigma \u03a3'], ['long', '0123456789']])
 
@@ -45,12 +48,12 @@
         assert_array_equal(B, A)
         assert_equal(B.dtype, A.dtype)
         assert_equal(B.shape, A.shape)
-        B = np.char.array(A, unicode=True)
+        B = np.char.array(A, **kw_unicode_true)
         assert_array_equal(B, A)
         assert_equal(B.dtype, A.dtype)
         assert_equal(B.shape, A.shape)
         def fail():
-            B = np.char.array(A, unicode=False)
+            B = np.char.array(A, **kw_unicode_false)
         self.failUnlessRaises(UnicodeEncodeError, fail)
 
     def test_unicode_upconvert(self):

Modified: trunk/tools/py3tool.py
===================================================================
--- trunk/tools/py3tool.py	2010-02-20 18:06:35 UTC (rev 8141)
+++ trunk/tools/py3tool.py	2010-02-20 18:06:53 UTC (rev 8142)
@@ -35,7 +35,6 @@
     'numpy/core/code_generators/generate_numpy_api.py': '-x import',
     'numpy/core/code_generators/generate_ufunc_api.py': '-x import',
     'numpy/core/defchararray.py': '-x unicode',
-    'numpy/core/tests/test_defchararray.py': '-x unicode',
     'numpy/compat/py3k.py': '-x unicode',
 }
 



More information about the Numpy-svn mailing list