[pypy-svn] r76135 - in pypy/branch/interplevel-array: lib_pypy pypy/module/array/test pypy/module/test_lib_pypy
hakanardo at codespeak.net
hakanardo at codespeak.net
Mon Jul 12 13:38:18 CEST 2010
Author: hakanardo
Date: Mon Jul 12 13:38:17 2010
New Revision: 76135
Added:
pypy/branch/interplevel-array/pypy/module/array/test/test_array_old.py (contents, props changed)
- copied, changed from r76055, pypy/branch/interplevel-array/pypy/module/test_lib_pypy/test_array.py
Removed:
pypy/branch/interplevel-array/lib_pypy/oldarray.py
pypy/branch/interplevel-array/pypy/module/test_lib_pypy/test_array.py
Modified:
pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
Log:
reusing previous tests
Modified: pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/array/test/test_array.py (original)
+++ pypy/branch/interplevel-array/pypy/module/array/test/test_array.py Mon Jul 12 13:38:17 2010
@@ -16,18 +16,7 @@
assert a[5] == 7.42
-class AppTestArray:
- def setup_class(cls):
- cls.space = gettestobjspace(usemodules=('array','struct'))
- cls.w_array = cls.space.appexec([], """():
- import array
- return array.array
- """)
- cls.w_unpack = cls.space.appexec([], """():
- import struct
- return struct.unpack
- """)
-
+class BaseArrayTests:
def test_ctor(self):
raises(TypeError, self.array, 'hi')
raises(TypeError, self.array, 1)
@@ -566,6 +555,26 @@
# for t in 'bBhHiIlLfdcu':
# assert type(self.array(t)) is self.array
+class TestCPythonsOwnArray(BaseArrayTests):
+
+ def setup_class(cls):
+ import array
+ cls.array = array.array
+ import struct
+ cls.unpack = struct.unpack
+
+
+class AppTestArray(BaseArrayTests):
+ def setup_class(cls):
+ cls.space = gettestobjspace(usemodules=('array', 'struct'))
+ cls.w_array = cls.space.appexec([], """():
+ import array
+ return array.array
+ """)
+ cls.w_unpack = cls.space.appexec([], """():
+ import struct
+ return struct.unpack
+ """)
## class AppTestAppArray(AppTestArray):
## def setup_class(cls):
Copied: pypy/branch/interplevel-array/pypy/module/array/test/test_array_old.py (from r76055, pypy/branch/interplevel-array/pypy/module/test_lib_pypy/test_array.py)
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/test_lib_pypy/test_array.py (original)
+++ pypy/branch/interplevel-array/pypy/module/array/test/test_array_old.py Mon Jul 12 13:38:17 2010
@@ -70,27 +70,27 @@
cls.array = array
-class TestArrayOnTopOfCPython(BaseArrayTests):
+## class TestArrayOnTopOfCPython(BaseArrayTests):
- def setup_class(cls):
- from pypy.tool.lib_pypy import LIB_PYPY
- if not hasattr(struct, 'pack_into'):
- py.test.skip("requires CPython >= 2.5")
- import new
- path = LIB_PYPY.join('array.py')
- myarraymodule = new.module('array')
- execfile(str(path), myarraymodule.__dict__)
- cls.array = myarraymodule
+## def setup_class(cls):
+## from pypy.tool.lib_pypy import LIB_PYPY
+## if not hasattr(struct, 'pack_into'):
+## py.test.skip("requires CPython >= 2.5")
+## import new
+## path = LIB_PYPY.join('array.py')
+## myarraymodule = new.module('array')
+## execfile(str(path), myarraymodule.__dict__)
+## cls.array = myarraymodule
- def test_unicode(self):
- py.test.skip("no 'u' type code in CPython's struct module")
+## def test_unicode(self):
+## py.test.skip("no 'u' type code in CPython's struct module")
- def test_pickle(self):
- py.test.skip("pickle getting confused by the hack in setup_class()")
+## def test_pickle(self):
+## py.test.skip("pickle getting confused by the hack in setup_class()")
class AppTestArray(BaseArrayTests):
- usemodules = ['struct']
+ usemodules = ['struct', 'array']
def setup_class(cls):
"""
@@ -105,18 +105,18 @@
cls.w_native_sizes = cls.space.wrap(cls.native_sizes)
-class AppTestArrayWithRawFFI(AppTestArray):
- """
- The same as the base class, but with a space that also includes the
- _rawffi module. The array module internally uses it in this case.
- """
- usemodules = ['struct', '_rawffi']
-
- def test_buffer_info(self):
- a = self.array.array('l', [123, 456])
- assert a.itemsize == self.native_sizes['l']
- address, length = a.buffer_info()
- assert length == 2 # and not 2 * self.native_sizes['l']
- assert address != 0
- # should check the address via some unsafe peeking, but it's
- # not easy on top of py.py
+## class AppTestArrayWithRawFFI(AppTestArray):
+## """
+## The same as the base class, but with a space that also includes the
+## _rawffi module. The array module internally uses it in this case.
+## """
+## usemodules = ['struct', '_rawffi']
+
+## def test_buffer_info(self):
+## a = self.array.array('l', [123, 456])
+## assert a.itemsize == self.native_sizes['l']
+## address, length = a.buffer_info()
+## assert length == 2 # and not 2 * self.native_sizes['l']
+## assert address != 0
+## # should check the address via some unsafe peeking, but it's
+## # not easy on top of py.py
More information about the Pypy-commit
mailing list