[pypy-svn] r50024 - in pypy/branch/ghop-ropes-classes/pypy/rlib: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Dec 22 22:18:20 CET 2007
Author: cfbolz
Date: Sat Dec 22 22:18:20 2007
New Revision: 50024
Added:
pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py (contents, props changed)
pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py (contents, props changed)
Log:
a skeleton to give some hints as to how I would like things to proceed
Added: pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py
==============================================================================
--- (empty file)
+++ pypy/branch/ghop-ropes-classes/pypy/rlib/ropewrapper.py Sat Dec 22 22:18:20 2007
@@ -0,0 +1,7 @@
+from pypy.rlib import rope
+
+class RopeString(object):
+ pass
+
+class RopeUnicode(object):
+ pass
Added: pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py
==============================================================================
--- (empty file)
+++ pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py Sat Dec 22 22:18:20 2007
@@ -0,0 +1,45 @@
+from pypy.rlib.ropewrapper import RopeUnicode, RopeString
+
+class AbstractTest(object):
+
+ def test_construction(self):
+ s = self.const("abc")
+ assert len(s) == 3
+ assert s[0] == self.const("a")
+ assert s[1] == self.const("b")
+ assert s[2] == self.const("c")
+
+ def test_add(self):
+ s1 = self.const("abc")
+ s2 = self.const("def")
+ s = s1 + s2
+ assert s[0] == self.const("a")
+ assert s[1] == self.const("b")
+ assert s[2] == self.const("c")
+ assert s[3] == self.const("d")
+ assert s[4] == self.const("e")
+ assert s[5] == self.const("f")
+
+ def test_mul(self):
+ t = self.const("abc")
+ l = [t * 5, 5 * t]
+ for s in l:
+ for i in range(5):
+ assert s[i * 3 + 0] == self.const("a")
+ assert s[i * 3 + 1] == self.const("b")
+ assert s[i * 3 + 2] == self.const("c")
+
+
+class TestString(AbstractTest):
+ const = RopeString
+
+class TestPythonString(AbstractTest):
+ const = str
+
+class TestUnicode(AbstractTest):
+ const = RopeUnicode
+
+class TestPythonUnicode(AbstractTest):
+ const = unicode
+
+
More information about the Pypy-commit
mailing list