Put back trailing whitespace in doctest output.
[cython.git] / tests / run / unicodemethods.pyx
index e96829f3447cb76981cdfacb33e83bb6417773ec..12da08446522c7597ad88aef836e02ace4981ab9 100644 (file)
@@ -180,9 +180,12 @@ pipe_sep = u'|'
 
 @cython.test_fail_if_path_exists(
     "//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
-    "//CastNode", "//TypecastNode")
+    "//CastNode", "//TypecastNode",
+    "//SimpleCallNode//AttributeNode[@is_py_attr = true]")
 @cython.test_assert_path_exists(
-    "//PythonCapiCallNode")
+    "//SimpleCallNode",
+    "//SimpleCallNode//NoneCheckNode",
+    "//SimpleCallNode//AttributeNode[@is_py_attr = false]")
 def join(unicode sep, l):
     """
     >>> l = text.split()
@@ -197,9 +200,11 @@ def join(unicode sep, l):
 
 @cython.test_fail_if_path_exists(
     "//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
-    "//CastNode", "//TypecastNode", "//NoneCheckNode")
+    "//CastNode", "//TypecastNode", "//NoneCheckNode",
+    "//SimpleCallNode//AttributeNode[@is_py_attr = true]")
 @cython.test_assert_path_exists(
-    "//PythonCapiCallNode")
+    "//SimpleCallNode",
+    "//SimpleCallNode//AttributeNode[@is_py_attr = false]")
 def join_sep(l):
     """
     >>> l = text.split()
@@ -212,6 +217,22 @@ def join_sep(l):
     """
     return u'|'.join(l)
 
+@cython.test_assert_path_exists(
+    "//SimpleCallNode",
+    "//SimpleCallNode//NameNode")
+def join_unbound(unicode sep, l):
+    """
+    >>> l = text.split()
+    >>> len(l)
+    8
+    >>> print( pipe_sep.join(l) )
+    ab|jd|sdflk|as|sa|sadas|asdas|fsdf
+    >>> print( join_unbound(pipe_sep, l) )
+    ab|jd|sdflk|as|sa|sadas|asdas|fsdf
+    """
+    join = unicode.join
+    return join(sep, l)
+
 
 # unicode.startswith(s, prefix, [start, [end]])
 
@@ -234,12 +255,12 @@ def startswith(unicode s, sub):
 
     >>> PY_VERSION < (2,5) or text.startswith(('ab', 'ab '))
     True
-    >>> PY_VERSION < (2,5) or startswith(text, ('ab', 'ab ')) == 'MATCH'
-    True
+    >>> startswith(text, ('ab', 'ab '))
+    'MATCH'
     >>> PY_VERSION < (2,5) or not text.startswith((' ab', 'ab X'))
     True
-    >>> PY_VERSION < (2,5) or startswith(text, (' ab', 'ab X')) == 'NO MATCH'
-    True
+    >>> startswith(text, (' ab', 'ab X'))
+    'NO MATCH'
     """
     if s.startswith(sub):
         return 'MATCH'
@@ -290,12 +311,12 @@ def endswith(unicode s, sub):
 
     >>> PY_VERSION < (2,5) or text.endswith(('fsdf', 'fsdf '))
     True
-    >>> PY_VERSION < (2,5) or endswith(text, ('fsdf', 'fsdf ')) == 'MATCH'
-    True
+    >>> endswith(text, ('fsdf', 'fsdf '))
+    'MATCH'
     >>> PY_VERSION < (2,5) or not text.endswith(('fsdf', 'fsdf X'))
     True
-    >>> PY_VERSION < (2,5) or endswith(text, ('fsdf', 'fsdf X')) == 'NO MATCH'
-    True
+    >>> endswith(text, ('fsdf', 'fsdf X'))
+    'NO MATCH'
     """
     if s.endswith(sub):
         return 'MATCH'
@@ -321,12 +342,12 @@ def endswith_start_end(unicode s, sub, start, end):
 
     >>> PY_VERSION < (2,5) or text.endswith(('fsd', 'fsdf'), 10, len(text)-1)
     True
-    >>> PY_VERSION < (2,5) or endswith_start_end(text, ('fsd', 'fsdf'), 10, len(text)-1) == 'MATCH'
-    True
+    >>> endswith_start_end(text, ('fsd', 'fsdf'), 10, len(text)-1)
+    'MATCH'
     >>> PY_VERSION < (2,5) or not text.endswith(('fsdf ', 'fsdf X'), 10, len(text)-1)
     True
-    >>> PY_VERSION < (2,5) or endswith_start_end(text, ('fsdf ', 'fsdf X'), 10, len(text)-1) == 'NO MATCH'
-    True
+    >>> endswith_start_end(text, ('fsdf ', 'fsdf X'), 10, len(text)-1)
+    'NO MATCH'
     """
     if s.endswith(sub, start, end):
         return 'MATCH'