[pypy-svn] r51320 - pypy/branch/ghop-ropes-classes/pypy/rlib/test

vinogradov at codespeak.net vinogradov at codespeak.net
Thu Feb 7 19:20:45 CET 2008


Author: vinogradov
Date: Thu Feb  7 19:20:44 2008
New Revision: 51320

Modified:
   pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py
Log:
Add tests to basic index functionality

Modified: pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py
==============================================================================
--- pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py	(original)
+++ pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py	Thu Feb  7 19:20:44 2008
@@ -85,6 +85,15 @@
         assert s1.find(s1) == 0
         py.test.raises(TypeError, s1.find, 4)
     
+    def test_str_index(self):
+        s1 = self.const("Welcome to PyPy world")
+        assert s1.index("Py") == 11
+        py.test.raises(ValueError, s1.index, "dd")
+        py.test.raises(ValueError, s1.index, "py")
+        assert s1.index("Welcome to PyPy world") == 0
+        assert s1.index(s1) == 0
+        py.test.raises(TypeError, s1.index, 4)
+
 class AbstractRopeTest(object):
     def test_add_long(self):
         s1 = self.const("a")



More information about the Pypy-commit mailing list