[pypy-svn] r48802 - in pypy/branch/ropes-unicode/pypy/objspace/std: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Nov 19 17:09:23 CET 2007


Author: cfbolz
Date: Mon Nov 19 17:09:23 2007
New Revision: 48802

Modified:
   pypy/branch/ropes-unicode/pypy/objspace/std/ropeunicodeobject.py
   pypy/branch/ropes-unicode/pypy/objspace/std/test/test_unicodeobject.py
Log:
test and fix in swapcase


Modified: pypy/branch/ropes-unicode/pypy/objspace/std/ropeunicodeobject.py
==============================================================================
--- pypy/branch/ropes-unicode/pypy/objspace/std/ropeunicodeobject.py	(original)
+++ pypy/branch/ropes-unicode/pypy/objspace/std/ropeunicodeobject.py	Mon Nov 19 17:09:23 2007
@@ -439,10 +439,10 @@
     return _local_transform(w_self._node, _toupper)
 
 def _swapcase(ordch):
-    if unicodedb.islower(unichar):
-        return unichr(unicodedb.toupper(unichar))
-    elif unicodedb.isupper(unichar):
-        return unichr(unicodedb.tolower(unichar))
+    if unicodedb.islower(ordch):
+        return unichr(unicodedb.toupper(ordch))
+    elif unicodedb.isupper(ordch):
+        return unichr(unicodedb.tolower(ordch))
     else:
         return unichr(ordch)
 

Modified: pypy/branch/ropes-unicode/pypy/objspace/std/test/test_unicodeobject.py
==============================================================================
--- pypy/branch/ropes-unicode/pypy/objspace/std/test/test_unicodeobject.py	(original)
+++ pypy/branch/ropes-unicode/pypy/objspace/std/test/test_unicodeobject.py	Mon Nov 19 17:09:23 2007
@@ -544,3 +544,6 @@
         assert 'aaa'.count('a', 0, -1) == 2
         assert 'aaa'.count('a', 0, -10) == 0
         assert 'ababa'.count('aba') == 1
+
+    def test_swapcase(self):
+        assert u'\xe4\xc4\xdf'.swapcase() == u'\xc4\xe4\xdf'



More information about the Pypy-commit mailing list