[pypy-commit] pypy py3k: Change test_resize_forbidden_non_cpython to work on python 3.

Manuel Jacob noreply at buildbot.pypy.org
Wed Feb 13 22:25:00 CET 2013


Author: Manuel Jacob
Branch: py3k
Changeset: r61199:5e51cdf17291
Date: 2013-02-12 17:28 +0100
http://bitbucket.org/pypy/pypy/changeset/5e51cdf17291/

Log:	Change test_resize_forbidden_non_cpython to work on python 3.

diff --git a/lib-python/3.2/test/test_bytes.py b/lib-python/3.2/test/test_bytes.py
--- a/lib-python/3.2/test/test_bytes.py
+++ b/lib-python/3.2/test/test_bytes.py
@@ -931,19 +931,19 @@
         # bytearrays just because there are buffers around.  Instead,
         # we get (on PyPy) a buffer that follows the changes and resizes.
         b = bytearray(range(10))
-        for v in [memoryview(b), buffer(b)]:
-            b[5] = 99
-            self.assertIn(v[5], (99, chr(99)))
-            b[5] = 100
-            b += b
-            b += b
-            b += b
-            self.assertEquals(len(v), 80)
-            self.assertIn(v[5], (100, chr(100)))
-            self.assertIn(v[79], (9, chr(9)))
-            del b[10:]
-            self.assertRaises(IndexError, lambda: v[10])
-            self.assertEquals(len(v), 10)
+        v = memoryview(b)
+        b[5] = 99
+        self.assertIn(v[5], (99, bytes([99])))
+        b[5] = 100
+        b += b
+        b += b
+        b += b
+        self.assertEquals(len(v), 80)
+        self.assertIn(v[5], (100, bytes([100])))
+        self.assertIn(v[79], (9, bytes([9])))
+        del b[10:]
+        self.assertRaises(IndexError, lambda: v[10])
+        self.assertEquals(len(v), 10)
 
 
 class AssortedBytesTest(unittest.TestCase):


More information about the pypy-commit mailing list