Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r53881:8d078dd5f91a
Date: 2012-03-22 09:50 +0100
http://bitbucket.org/pypy/pypy/changeset/8d078dd5f91a/
Log: we no longer have the applevel 'buffer', so no way the get the raw
bytes of the unicode string. Hardcode the bytes because we know it's
UCS-4, at least on linux
diff --git a/pypy/module/struct/test/test_struct.py
b/pypy/module/struct/test/test_struct.py
--- a/pypy/module/struct/test/test_struct.py
+++ b/pypy/module/struct/test/test_struct.py
@@ -372,9 +372,11 @@
import sys
if '__pypy__' not in sys.builtin_module_names:
skip("PyPy extension")
- data = self.struct.pack("uuu", u'X', u'Y', u'Z')
- assert data == bytes(buffer(u'XYZ'))
- assert self.struct.unpack("uuu", data) == (u'X', u'Y', u'Z')
+ data = self.struct.pack("uuu", 'X', 'Y', 'Z')
+ # this assumes UCS4; adapt/extend the test on platforms where we use
+ # another format
+ assert data == b'X\x00\x00\x00Y\x00\x00\x00Z\x00\x00\x00'
+ assert self.struct.unpack("uuu", data) == ('X', 'Y', 'Z')
def test_unpack_buffer(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit