[pypy-commit] pypy ndarray-subtype: use appexec (amaury)

mattip noreply at buildbot.pypy.org
Fri Jul 5 13:12:46 CEST 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: ndarray-subtype
Changeset: r65192:7398ff65e206
Date: 2013-07-05 12:30 +0300
http://bitbucket.org/pypy/pypy/changeset/7398ff65e206/

Log:	use appexec (amaury)

diff --git a/pypy/module/micronumpy/test/test_subtype.py b/pypy/module/micronumpy/test/test_subtype.py
--- a/pypy/module/micronumpy/test/test_subtype.py
+++ b/pypy/module/micronumpy/test/test_subtype.py
@@ -5,22 +5,23 @@
 class AppTestSupport(BaseNumpyAppTest):
     def setup_class(cls):
         BaseNumpyAppTest.setup_class.im_func(cls)
-        '''
-        from numpypy import ndarray
-        class NoNew(ndarray):
-            def __new__(cls):
-                raise ValueError('should not call __new__')
-            def __array_finalize(self, obj):
-                self.called_finalize = True
-        class SubType(ndarray):
-            def __new__(cls):
-                cls.called_new = True
-                return cls
-            def __array_finalize(self, obj):
-                self.called_finalize = True
-        cls.w_NoNew = cls.space.wrap(NoNew)
-        cls.w_SubType = cls.space.wrap(SubType)
-        '''
+        cls.w_NoNew = cls.space.appexec([], '''():
+            from numpypy import ndarray
+            class NoNew(ndarray):
+                def __new__(cls):
+                    raise ValueError('should not call __new__')
+                def __array_finalize(self, obj):
+                    self.called_finalize = True
+            return NoNew ''')
+        cls.w_SubType = cls.space.appexec([], '''():
+            from numpypy import ndarray
+            class SubType(ndarray):
+                def __new__(cls):
+                    cls.called_new = True
+                    return cls
+                def __array_finalize(self, obj):
+                    self.called_finalize = True
+            return SubType ''')
 
     def test_finalize(self):
         #taken from http://docs.scipy.org/doc/numpy/user/basics.subclassing.html#simple-example-adding-an-extra-attribute-to-ndarray


More information about the pypy-commit mailing list