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

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Nov 19 15:30:05 CET 2007


Author: cfbolz
Date: Mon Nov 19 15:30:05 2007
New Revision: 48791

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


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 15:30:05 2007
@@ -745,7 +745,7 @@
         return space.newtuple([W_RopeUnicodeObject.EMPTY,
                                W_RopeUnicodeObject.EMPTY, w_unistr])
     else:
-        assert pos > 0
+        assert pos >= 0
         return space.newtuple([space.wrap(unistr[:pos]), w_unisub,
                                space.wrap(unistr[pos+len(unisub):])])
 

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 15:30:05 2007
@@ -491,15 +491,15 @@
 
     def test_rpartition(self):
 
-        assert ('this is the rparti', 'ti', 'on method') == \
-            'this is the rpartition method'.rpartition('ti')
+        assert (u'this is the rparti', u'ti', u'on method') == \
+            u'this is the rpartition method'.rpartition(u'ti')
 
         # from raymond's original specification
-        S = 'http://www.python.org'
-        assert ('http', '://', 'www.python.org') == S.rpartition('://')
-        assert ('', '', 'http://www.python.org') == S.rpartition('?')
-        assert ('', 'http://', 'www.python.org') == S.rpartition('http://')
-        assert ('http://www.python.', 'org', '') == S.rpartition('org')
+        S = u'http://www.python.org'
+        assert (u'http', u'://', u'www.python.org') == S.rpartition(u'://')
+        assert (u'', u'', u'http://www.python.org') == S.rpartition(u'?')
+        assert (u'', u'http://', u'www.python.org') == S.rpartition(u'http://')
+        assert (u'http://www.python.', u'org', u'') == S.rpartition(u'org')
 
-        raises(ValueError, S.rpartition, '')
+        raises(ValueError, S.rpartition, u'')
         raises(TypeError, S.rpartition, None)



More information about the Pypy-commit mailing list