Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r82021:44aa48e4d16a
Date: 2016-02-01 00:31 +0100
http://bitbucket.org/pypy/pypy/changeset/44aa48e4d16a/
Log: Fix unicode.capitalize() test to pass with CPython3.3, and implement
it for PyPy. Probably not the fastest implementation...
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
@@ -217,7 +217,7 @@
# check that titlecased chars are lowered correctly
# \u1ffc is the titlecased char
assert ('\u1ff3\u1ff3\u1ffc\u1ffc'.capitalize() ==
- '\u1ffc\u1ff3\u1ff3\u1ff3')
+ '\u03a9\u0399\u1ff3\u1ff3\u1ff3')
# check with cased non-letter chars
assert ('\u24c5\u24ce\u24c9\u24bd\u24c4\u24c3'.capitalize() ==
'\u24c5\u24e8\u24e3\u24d7\u24de\u24dd')
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
@@ -155,13 +155,16 @@
return unicodedb.islinebreak(ord(ch))
def _upper(self, ch):
- return unichr(unicodedb.toupper(ord(ch)))
+ return u''.join([unichr(x) for x in
+ unicodedb.toupper_full(ord(ch))])
def _lower(self, ch):
- return unichr(unicodedb.tolower(ord(ch)))
+ return u''.join([unichr(x) for x in
+ unicodedb.tolower_full(ord(ch))])
def _title(self, ch):
- return unichr(unicodedb.totitle(ord(ch)))
+ return u''.join([unichr(x) for x in
+ unicodedb.totitle_full(ord(ch))])
def _newlist_unwrapped(self, space, lst):
return space.newlist_unicode(lst)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit