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

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Dec 25 21:28:25 CET 2007


Author: cfbolz
Date: Tue Dec 25 21:28:23 2007
New Revision: 50115

Modified:
   pypy/branch/ghop-ropes-classes/pypy/rlib/test/test_ropewrapper.py
Log:
a failing test: RopeString + RopeUnicode should give a RopeUnicode.


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	Tue Dec 25 21:28:23 2007
@@ -69,4 +69,21 @@
 class TestPythonUnicode(AbstractTest):
     const = unicode
 
+class AbstractTestCoercion(object):
+    def test_add_coercion(self):
+        s1 = self.conststr("abc")
+        s2 = self.constunicode("def")
+        s = s1 + s2
+        assert isinstance(s, self.constunicode)
+        assert s == self.constunicode("abcdef")
+        s = s2 + s1
+        assert isinstance(s, self.constunicode)
+        assert s == self.constunicode("defabc")
 
+class TestPythonCoercion(AbstractTestCoercion):
+    conststr = str
+    constunicode = unicode
+
+class TestRopesCoercion(AbstractTestCoercion):
+    conststr = RopeString
+    constunicode = RopeUnicode



More information about the Pypy-commit mailing list