[pypy-commit] pypy unicode-utf8-py3: test, fix capitalize with sigma in final position
mattip
pypy.commits at gmail.com
Tue Jan 22 05:37:44 EST 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95691:1142ef536c49
Date: 2019-01-22 11:03 +0200
http://bitbucket.org/pypy/pypy/changeset/1142ef536c49/
Log: test, fix capitalize with sigma in final position
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
@@ -387,6 +387,7 @@
assert u'\ud800'.upper() == u'\ud800'
def test_capitalize(self):
+ assert u'A\u0345\u03a3'.capitalize() == u'A\u0345\u03c2'
assert u"brown fox".capitalize() == u"Brown fox"
assert u' hello '.capitalize() == u' hello '
assert u'Hello '.capitalize() == u'Hello '
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
@@ -856,8 +856,12 @@
builder.append_code(c)
for ch in it:
ch = unicodedb.tolower_full(ch)
- for ch1 in ch:
- builder.append_code(ch1)
+ if it.done():
+ # Special case lower-sigma
+ if ch[-1] == 0x03c3:
+ ch[-1] = 0x03c2
+ for c in ch:
+ builder.append_code(c)
return self.from_utf8builder(builder)
@unwrap_spec(width=int, w_fillchar=WrappedDefault(u' '))
More information about the pypy-commit
mailing list