[pypy-commit] pypy py3k: we cannot mix bytes and unicode when .join(); adapt one test and kill the other
antocuni
noreply at buildbot.pypy.org
Wed Mar 21 20:40:22 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53873:2bbc42be3c96
Date: 2012-03-21 20:16 +0100
http://bitbucket.org/pypy/pypy/changeset/2bbc42be3c96/
Log: we cannot mix bytes and unicode when .join(); adapt one test and
kill the other
diff --git a/pypy/objspace/std/test/test_stringobject.py b/pypy/objspace/std/test/test_stringobject.py
--- a/pypy/objspace/std/test/test_stringobject.py
+++ b/pypy/objspace/std/test/test_stringobject.py
@@ -525,35 +525,7 @@
raises(TypeError, b''.join, [[1]])
def test_unicode_join_str_arg_ascii(self):
- raises(UnicodeDecodeError, u''.join, ['\xc3\xa1'])
-
- def test_unicode_join_str_arg_utf8(self):
- # Need default encoding utf-8, but sys.setdefaultencoding
- # is removed after startup.
- import sys
- if not hasattr(sys, 'setdefaultencoding'):
- skip("sys.setdefaultencoding() not available")
- old_encoding = sys.getdefaultencoding()
- # Duplicate unittest.test_support.CleanImport logic because it won't
- # import.
- self.original_modules = sys.modules.copy()
- try:
- import sys as temp_sys
- module_name = 'sys'
- if module_name in sys.modules:
- module = sys.modules[module_name]
- # It is possible that module_name is just an alias for
- # another module (e.g. stub for modules renamed in 3.x).
- # In that case, we also need delete the real module to
- # clear the import cache.
- if module.__name__ != module_name:
- del sys.modules[module.__name__]
- del sys.modules[module_name]
- temp_sys.setdefaultencoding('utf-8')
- assert u''.join(['\xc3\xa1']) == u'\xe1'
- finally:
- temp_sys.setdefaultencoding(old_encoding)
- sys.modules.update(self.original_modules)
+ raises(TypeError, ''.join, [b'\xc3\xa1'])
def test_unicode_join_endcase(self):
# This class inserts a Unicode object into its argument's natural
More information about the pypy-commit
mailing list