[pypy-commit] pypy refactor-str-types: Fix app-level unicode's istitle() method.
Manuel Jacob
noreply at buildbot.pypy.org
Mon Jul 29 14:55:36 CEST 2013
Author: Manuel Jacob
Branch: refactor-str-types
Changeset: r65778:76dd0077753a
Date: 2013-07-29 14:52 +0200
http://bitbucket.org/pypy/pypy/changeset/76dd0077753a/
Log: Fix app-level unicode's istitle() method.
diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py
--- a/pypy/objspace/std/stringmethods.py
+++ b/pypy/objspace/std/stringmethods.py
@@ -357,7 +357,7 @@
for pos in range(0, len(input)):
ch = input[pos]
- if self._isupper(ch):
+ if self._istitle(ch):
if previous_is_cased:
return space.w_False
previous_is_cased = True
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
@@ -215,7 +215,9 @@
assert u"!Brown Fox".istitle() == True
assert u"Brow&&&&N Fox".istitle() == True
assert u"!Brow&&&&n Fox".istitle() == False
-
+ assert u'\u1FFc'.istitle()
+ assert u'Greek \u1FFcitlecases ...'.istitle()
+
def test_capitalize(self):
assert u"brown fox".capitalize() == u"Brown fox"
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
@@ -105,7 +105,7 @@
return unicodedb.isnumeric(ord(ch))
def _istitle(self, ch):
- return unicodedb.istitle(ord(ch))
+ return unicodedb.isupper(ord(ch)) or unicodedb.istitle(ord(ch))
def _isspace(self, ch):
return unicodedb.isspace(ord(ch))
More information about the pypy-commit
mailing list