Author: Amaury Forgeot d'Arc <[email protected]>
Branch:
Changeset: r57109:b7ae2a1338cb
Date: 2012-09-03 22:19 +0200
http://bitbucket.org/pypy/pypy/changeset/b7ae2a1338cb/
Log: Copy the test from cffi/c/test_c
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -21,7 +21,10 @@
mandatory_b_prefix = 'b'
mandatory_u_prefix = ''
readbuf = lambda buf: buf.tobytes()
- bufchar = ord
+ if sys.version_info < (3, 3):
+ bufchar = lambda x: bytes([ord(x)])
+ else:
+ bufchar = ord
bytechr = lambda n: bytes([n])
u = ""
@@ -906,7 +909,7 @@
('j', BInt, -1)])
BFunc21 = new_function_type((BStruct,), BInt, False)
f = cast(BFunc21, _testfunc(21))
- res = f(range(13, 3, -1))
+ res = f(list(range(13, 3, -1)))
lst = [(n << i) for (i, n) in enumerate(range(13, 3, -1))]
assert res == sum(lst)
@@ -1076,7 +1079,7 @@
('i', BInt, -1),
('j', BInt, -1)])
def cb():
- return newp(BStructPtr, range(13, 3, -1))[0]
+ return newp(BStructPtr, list(range(13, 3, -1)))[0]
BFunc = new_function_type((), BStruct)
f = callback(BFunc, cb)
s = f()
@@ -1810,11 +1813,12 @@
c[2] = b'-'
buf[:2] = b'HI'
assert string(c) == b'HI-there'
- assert buf[:4:2] == b'H-'
- if '__pypy__' not in sys.builtin_module_names:
- # XXX pypy doesn't support the following assignment so far
- buf[:4:2] = b'XY'
- assert string(c) == b'XIYthere'
+ if sys.version_info < (3,) or sys.version_info >= (3, 3):
+ assert buf[:4:2] == b'H-'
+ if '__pypy__' not in sys.builtin_module_names:
+ # XXX pypy doesn't support the following assignment so far
+ buf[:4:2] = b'XY'
+ assert string(c) == b'XIYthere'
def test_getcname():
BUChar = new_primitive_type("unsigned char")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit