Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95008:945e1048b6b4
Date: 2018-08-17 02:55 +0300
http://bitbucket.org/pypy/pypy/changeset/945e1048b6b4/
Log: str_w -> text_w, raises -> pytest.raises (python3 testing artifact?)
diff --git a/pypy/module/cpyext/test/test_dictobject.py
b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -1,4 +1,5 @@
import py
+from pytest import raises
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.module.cpyext.test.test_api import BaseApiTest, raises_w
from pypy.module.cpyext.api import Py_ssize_tP, PyObjectP, PyTypeObjectPtr
diff --git a/pypy/module/cpyext/test/test_import.py
b/pypy/module/cpyext/test/test_import.py
--- a/pypy/module/cpyext/test/test_import.py
+++ b/pypy/module/cpyext/test/test_import.py
@@ -18,7 +18,7 @@
with rffi.scoped_str2charp("foobar") as modname:
w_foobar = PyImport_AddModule(space, modname)
- assert space.str_w(space.getattr(w_foobar,
+ assert space.text_w(space.getattr(w_foobar,
space.wrap('__name__'))) == 'foobar'
def test_getmoduledict(self, space, api):
diff --git a/pypy/module/cpyext/test/test_object.py
b/pypy/module/cpyext/test/test_object.py
--- a/pypy/module/cpyext/test/test_object.py
+++ b/pypy/module/cpyext/test/test_object.py
@@ -107,15 +107,15 @@
def test_str(self, space, api):
w_list = space.newlist([space.w_None, space.wrap(42)])
- assert space.str_w(api.PyObject_Str(None)) == "<NULL>"
- assert space.str_w(api.PyObject_Str(w_list)) == "[None, 42]"
- assert space.str_w(api.PyObject_Str(space.wrap("a"))) == "a"
+ assert space.text_w(api.PyObject_Str(None)) == "<NULL>"
+ assert space.text_w(api.PyObject_Str(w_list)) == "[None, 42]"
+ assert space.text_w(api.PyObject_Str(space.wrap("a"))) == "a"
def test_repr(self, space, api):
w_list = space.newlist([space.w_None, space.wrap(42)])
- assert space.str_w(api.PyObject_Repr(None)) == "<NULL>"
- assert space.str_w(api.PyObject_Repr(w_list)) == "[None, 42]"
- assert space.str_w(api.PyObject_Repr(space.wrap("a"))) == "'a'"
+ assert space.text_w(api.PyObject_Repr(None)) == "<NULL>"
+ assert space.text_w(api.PyObject_Repr(w_list)) == "[None, 42]"
+ assert space.text_w(api.PyObject_Repr(space.wrap("a"))) == "'a'"
def test_RichCompare(self, space, api):
def compare(w_o1, w_o2, opid):
@@ -204,7 +204,7 @@
def test_format(self, space, api):
w_int = space.wrap(42)
- fmt = space.str_w(api.PyObject_Format(w_int, space.wrap('#b')))
+ fmt = space.text_w(api.PyObject_Format(w_int, space.wrap('#b')))
assert fmt == '0b101010'
class AppTestObject(AppTestCpythonExtensionBase):
diff --git a/pypy/module/cpyext/test/test_pyfile.py
b/pypy/module/cpyext/test/test_pyfile.py
--- a/pypy/module/cpyext/test/test_pyfile.py
+++ b/pypy/module/cpyext/test/test_pyfile.py
@@ -33,18 +33,18 @@
rffi.free_charp(mode)
w_line = api.PyFile_GetLine(w_file, 0)
- assert space.str_w(w_line) == "line1\n"
+ assert space.text_w(w_line) == "line1\n"
w_line = api.PyFile_GetLine(w_file, 4)
- assert space.str_w(w_line) == "line"
+ assert space.text_w(w_line) == "line"
w_line = api.PyFile_GetLine(w_file, 0)
- assert space.str_w(w_line) == "2\n"
+ assert space.text_w(w_line) == "2\n"
# XXX We ought to raise an EOFError here, but don't
w_line = api.PyFile_GetLine(w_file, -1)
# assert api.PyErr_Occurred() is space.w_EOFError
- assert space.str_w(w_line) == "line3\n"
+ assert space.text_w(w_line) == "line3\n"
space.call_method(w_file, "close")
@@ -53,7 +53,7 @@
with rffi.scoped_str2charp(name) as filename:
with rffi.scoped_str2charp("wb") as mode:
w_file = api.PyFile_FromString(filename, mode)
- assert space.str_w(api.PyFile_Name(w_file)) == name
+ assert space.text_w(api.PyFile_Name(w_file)) == name
@pytest.mark.xfail
def test_file_setbufsize(self, space, api):
diff --git a/pypy/module/cpyext/test/test_sequence.py
b/pypy/module/cpyext/test/test_sequence.py
--- a/pypy/module/cpyext/test/test_sequence.py
+++ b/pypy/module/cpyext/test/test_sequence.py
@@ -68,7 +68,7 @@
with pytest.raises(OperationError) as excinfo:
PySequence_Fast(space, space.wrap(3), message)
assert excinfo.value.match(space, space.w_TypeError)
- assert space.str_w(excinfo.value.get_w_value(space)) == "message"
+ assert space.text_w(excinfo.value.get_w_value(space)) == "message"
rffi.free_charp(message)
def test_get_slice(self, space, api):
@@ -97,7 +97,7 @@
w_iter = api.PySeqIter_New(w_t)
assert space.unwrap(space.next(w_iter)) == 1
assert space.unwrap(space.next(w_iter)) == 2
- exc = raises(OperationError, space.next, w_iter)
+ exc = pytest.raises(OperationError, space.next, w_iter)
assert exc.value.match(space, space.w_StopIteration)
def test_contains(self, space):
diff --git a/pypy/module/cpyext/test/test_unicodeobject.py
b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -534,7 +534,7 @@
w_s = PyUnicode_EncodeFSDefault(space, w_u)
except OperationError:
py.test.skip("Requires a unicode-aware fsencoding")
- with rffi.scoped_str2charp(space.str_w(w_s)) as encoded:
+ with rffi.scoped_str2charp(space.text_w(w_s)) as encoded:
w_decoded = PyUnicode_DecodeFSDefaultAndSize(space, encoded,
space.len_w(w_s))
assert space.eq_w(w_decoded, w_u)
w_decoded = PyUnicode_DecodeFSDefault(space, encoded)
@@ -681,7 +681,7 @@
def test_decode_null_encoding(self, space):
null_charp = lltype.nullptr(rffi.CCHARP.TO)
u_text = u'abcdefg'
- s_text = space.str_w(PyUnicode_AsEncodedString(space,
space.wrap(u_text), null_charp, null_charp))
+ s_text = space.text_w(PyUnicode_AsEncodedString(space,
space.wrap(u_text), null_charp, null_charp))
b_text = rffi.str2charp(s_text)
assert (space.utf8_w(PyUnicode_Decode(
space, b_text, len(s_text), null_charp, null_charp)) ==
@@ -701,7 +701,7 @@
w_bytes = PyUnicode_EncodeMBCS(space, wbuf, 4, None)
rffi.free_wcharp(wbuf)
assert space.type(w_bytes) is space.w_bytes
- assert space.str_w(w_bytes) == "abc?"
+ assert space.text_w(w_bytes) == "abc?"
def test_escape(self, space):
def test(ustr):
diff --git a/pypy/module/cpyext/test/test_userslots.py
b/pypy/module/cpyext/test/test_userslots.py
--- a/pypy/module/cpyext/test/test_userslots.py
+++ b/pypy/module/cpyext/test/test_userslots.py
@@ -21,7 +21,7 @@
assert py_datetype.c_tp_as_number.c_nb_add
w_obj = generic_cpy_call(space, py_datetype.c_tp_as_number.c_nb_add,
py_date, py_date)
- assert space.str_w(w_obj) == 'sum!'
+ assert space.text_w(w_obj) == 'sum!'
def test_tp_new_from_python(self, space, api):
w_date = space.appexec([], """():
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit