Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r89072:7d75f981d293 Date: 2016-12-15 15:35 +0100 http://bitbucket.org/pypy/pypy/changeset/7d75f981d293/
Log: "Fix" these tests by changing 'str_or_None' to mean that bytes are not acceptable diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1567,7 +1567,8 @@ return self.buffer_w(w_obj, flags).as_str() def str_or_None_w(self, w_obj): - return None if self.is_none(w_obj) else self.str_w(w_obj) + # FIXME: XXX for now, inconsistent with str_w() + return None if self.is_none(w_obj) else self.identifier_w(w_obj) def str_w(self, w_obj): """ diff --git a/pypy/objspace/std/test/test_bytearrayobject.py b/pypy/objspace/std/test/test_bytearrayobject.py --- a/pypy/objspace/std/test/test_bytearrayobject.py +++ b/pypy/objspace/std/test/test_bytearrayobject.py @@ -38,6 +38,9 @@ raises(ValueError, bytearray, [65, -3]) raises(TypeError, bytearray, [65.0]) raises(ValueError, bytearray, -1) + assert bytearray('abc', 'ascii') == b'abc' + raises(TypeError, bytearray, 'abc', b'ascii') + raises(UnicodeEncodeError, bytearray, '\x80', 'ascii') def test_init_override(self): class subclass(bytearray): diff --git a/pypy/objspace/std/test/test_bytesobject.py b/pypy/objspace/std/test/test_bytesobject.py --- a/pypy/objspace/std/test/test_bytesobject.py +++ b/pypy/objspace/std/test/test_bytesobject.py @@ -108,6 +108,8 @@ assert bytes([42]) == b'*' assert bytes([0xFC]) == b'\xFC' assert bytes([42, 0xCC]) == b'*\xCC' + raises(TypeError, bytes, 'abc', b'ascii') + raises(UnicodeEncodeError, bytes, '\x80', 'ascii') def test_constructor_list_of_objs(self): class X: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit