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

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Dec 23 17:03:12 CET 2007


Author: cfbolz
Date: Sun Dec 23 17:03:11 2007
New Revision: 50042

Modified:
   pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py
Log:
some more failing tests


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	Sun Dec 23 17:03:11 2007
@@ -29,6 +29,34 @@
                 assert s[i * 3 + 1] == self.const("b")
                 assert s[i * 3 + 2] == self.const("c")
 
+    def test_slice(self):
+        import pdb; pdb.set_trace()
+        s = self.const("abcd") * 100 + self.const("efghi") * 100
+        assert s[1::1] == self.const("bcd" + "abcd" * 99 + "efghi" * 100)
+        assert s[1:-1:1] == self.const("bcd" + "abcd" * 99 +
+                                       "efghi" * 99 + "efgh")
+
+    def test_compare(self):
+        s1 = self.const("abc")
+        s2 = self.const("abc")
+        assert s1 == s2
+        assert not s1 != s2
+
+    def test_iteration(self):
+        # XXX rope iteration is working but should use a custom iterator
+        # e.g. define an __iter__ method
+        s = self.const("abcdefghijkl")
+        i = 0
+        for c in s:
+            assert c == s[i]
+            i += 1
+        assert i == len(s)
+
+    def test_hash(self):
+        s1 = self.const("abc")
+        s2 = self.const("abc")
+        assert hash(s1) == hash(s2)
+
 
 class TestString(AbstractTest):
     const = RopeString



More information about the Pypy-commit mailing list