Author: Manuel Jacob
Branch: py3k
Changeset: r61375:252004d8094b
Date: 2013-02-17 15:43 +0100
http://bitbucket.org/pypy/pypy/changeset/252004d8094b/

Log:    Revert some changes in this test: __getitem__ on _rawffi char arrays
        is supposed to return one-byte strings instead of integers.

diff --git a/pypy/module/_rawffi/test/test__rawffi.py 
b/pypy/module/_rawffi/test/test__rawffi.py
--- a/pypy/module/_rawffi/test/test__rawffi.py
+++ b/pypy/module/_rawffi/test/test__rawffi.py
@@ -282,10 +282,10 @@
         import _rawffi
         A = _rawffi.Array('c')
         buf = A(10, autofree=True)
-        buf[0] = ord('*')
+        buf[0] = b'*'
         assert buf[1:5] == b'\x00' * 4
         buf[7:] = b'abc'
-        assert buf[9] == ord('c')
+        assert buf[9] == b'c'
         assert buf[:8] == b'*' + b'\x00'*6 + b'a'
 
     def test_returning_str(self):
@@ -450,13 +450,13 @@
         X = _rawffi.Structure([('x1', 'i'), ('x2', 'h'), ('x3', 'c'), ('next', 
'P')])
         next = X()
         next.next = 0
-        next.x3 = ord('x')
+        next.x3 = b'x'
         x = X()
         x.next = next
         x.x1 = 1
         x.x2 = 2
-        x.x3 = ord('x')
-        assert X.fromaddress(x.next).x3 == ord('x')
+        x.x3 = b'x'
+        assert X.fromaddress(x.next).x3 == b'x'
         x.free()
         next.free()
         create_double_struct = lib.ptr("create_double_struct", [], 'P')
@@ -997,15 +997,15 @@
 
         A = _rawffi.Array('c')
         a = A(10, autofree=True)
-        a[3] = ord('x')
+        a[3] = b'x'
         b = memoryview(a)
         assert len(b) == 10
         assert b[3] == b'x'
         b[6] = b'y'
-        assert a[6] == ord('y')
+        assert a[6] == b'y'
         b[3:5] = b'zt'
-        assert a[3] == ord('z')
-        assert a[4] == ord('t')
+        assert a[3] == b'z'
+        assert a[4] == b't'
 
     def test_union(self):
         import _rawffi
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to