[pypy-svn] r66075 - pypy/branch/pyjitpl5/pypy/rpython/test

arigo at codespeak.net arigo at codespeak.net
Tue Jun 30 16:40:06 CEST 2009


Author: arigo
Date: Tue Jun 30 16:40:04 2009
New Revision: 66075

Added:
   pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py.merge.tmp
      - copied, changed from r66039, pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py
Log:
merging of svn+ssh://codespeak.net/svn/pypy/trunk/pypy/rpython/test/test_rstr.py
revisions 62865 to 66039:

    ------------------------------------------------------------------------
    r65710 | benjamin | 2009-06-10 05:26:13 +0200 (Wed, 10 Jun 2009) | 1 line
    
    test that the parameter can be optional
    ------------------------------------------------------------------------
    r65706 | benjamin | 2009-06-10 02:09:32 +0200 (Wed, 10 Jun 2009) | 1 line
    
    implement str.splitlines() for rpython
    ------------------------------------------------------------------------
    r65105 | jandem | 2009-05-06 16:53:38 +0200 (Wed, 06 May 2009) | 2 lines
    
    add tests for commit 65097
    
    ------------------------------------------------------------------------


Copied: pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py.merge.tmp (from r66039, pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py)
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/test/test_rstr.py.merge.tmp	Tue Jun 30 16:40:04 2009
@@ -271,6 +271,17 @@
             res = self.interpret(fn, [i, j])
             assert res == fn(i, j)
 
+    def test_find_TyperError(self):
+        const = self.const
+        def f():
+            s = const('abc')
+            s.find(s, 0, -10)
+        raises(TyperError, self.interpret, f, ())
+        def f():
+            s = const('abc')
+            s.find(s, -10)
+        raises(TyperError, self.interpret, f, ())
+
     def test_find_empty_string(self):
         const = self.const
         def f(i):
@@ -543,6 +554,21 @@
             res = self.ll_to_string(self.interpret(dummy, []))
             assert res == expected
 
+    def test_splitlines(self):
+        const = self.const
+        def f(i, newlines):
+            s = [const(''), const("\n"), const("\n\n"), const("hi\n"),
+                 const("random data\r\n"), const("\r\n"), const("\rdata")]
+            test_string = s[i]
+            if newlines:
+                return len(test_string.splitlines(True))
+            else:
+                return len(test_string.splitlines())
+        for newlines in (True, False):
+            for i in xrange(5):
+                res = self.interpret(f, [i, newlines])
+                assert res == f(i, newlines)
+
     def test_split(self):
         const = self.const
         def fn(i):
@@ -715,6 +741,17 @@
         res = self.interpret(fn, [])
         assert res == 1
        
+    def test_count_TyperError(self):
+        const = self.const
+        def f():
+            s = const('abc')
+            s.count(s, 0, -10)
+        raises(TyperError, self.interpret, f, ())
+        def f():
+            s = const('abc')
+            s.count(s, -10)
+        raises(TyperError, self.interpret, f, ())
+    
     def test_getitem_exc(self):
         const = self.const
         def f(x):



More information about the Pypy-commit mailing list