Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8 Changeset: r95585:fb8915bddd8d Date: 2019-01-06 20:30 +0200 http://bitbucket.org/pypy/pypy/changeset/fb8915bddd8d/
Log: test, fix bug in unicode.title diff --git a/pypy/objspace/std/test/test_unicodeobject.py b/pypy/objspace/std/test/test_unicodeobject.py --- a/pypy/objspace/std/test/test_unicodeobject.py +++ b/pypy/objspace/std/test/test_unicodeobject.py @@ -372,6 +372,8 @@ assert u"bro!wn fox".title() == u"Bro!Wn Fox" assert u"brow\u4321n fox".title() == u"Brow\u4321N Fox" assert u'\ud800'.title() == u'\ud800' + assert (unichr(0x345) + u'abc').title() == u'\u0399Abc' + assert (unichr(0x345) + u'ABC').title() == u'\u0399Abc' def test_istitle(self): assert u"".istitle() == False diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -345,13 +345,13 @@ input = self._utf8 builder = rutf8.Utf8StringBuilder(len(input)) previous_is_cased = False - for ch in rutf8.Utf8StringIterator(input): + for ch0 in rutf8.Utf8StringIterator(input): if not previous_is_cased: - ch = unicodedb.totitle(ch) + ch1 = unicodedb.totitle(ch0) else: - ch = unicodedb.tolower(ch) - builder.append_code(ch) - previous_is_cased = unicodedb.iscased(ch) + ch1 = unicodedb.tolower(ch0) + builder.append_code(ch1) + previous_is_cased = unicodedb.iscased(ch0) return self.from_utf8builder(builder) def descr_translate(self, space, w_table): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit