[pypy-commit] pypy py3.5: Fix tests for CPython -A
rlamy
pypy.commits at gmail.com
Wed Nov 23 14:29:58 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r88590:b5e49d334122
Date: 2016-11-23 19:29 +0000
http://bitbucket.org/pypy/pypy/changeset/b5e49d334122/
Log: Fix tests for CPython -A
diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -4,15 +4,6 @@
class AppTestArrayModule(AppTestCpythonExtensionBase):
enable_leak_checking = True
- def setup_class(cls):
- from rpython.tool.udir import udir
- AppTestCpythonExtensionBase.setup_class.im_func(cls)
- if option.runappdirect:
- cls.w_udir = str(udir)
- else:
- cls.w_udir = cls.space.wrap(str(udir))
-
-
def test_basic(self):
module = self.import_module(name='array')
arr = module.array('i', [1,2,3])
@@ -105,30 +96,28 @@
# Not really part of array, refactor
import struct
module = self.import_module(name='array')
- val = module.readbuffer_as_string('abcd')
- assert val == 'abcd'
- val = module.readbuffer_as_string(u'\u03a3')
- assert val is not None
+ val = module.readbuffer_as_string(b'abcd')
+ assert val == b'abcd'
def test_readinto(self):
module = self.import_module(name='array')
- a = module.array('c')
- a.fromstring('0123456789')
+ a = module.array('B')
+ a.fromstring(b'0123456789')
filename = self.udir + "/_test_file"
f = open(filename, 'w+b')
- f.write('foobar')
+ f.write(b'foobar')
f.seek(0)
n = f.readinto(a)
f.close()
assert n == 6
assert len(a) == 10
- assert a.tostring() == 'foobar6789'
+ assert a.tostring() == b'foobar6789'
def test_iowrite(self):
module = self.import_module(name='array')
from io import BytesIO
- a = module.array('c')
- a.fromstring('0123456789')
+ a = module.array('B')
+ a.fromstring(b'0123456789')
fd = BytesIO()
# only test that it works
fd.write(a)
More information about the pypy-commit
mailing list