Commit a337a45f authored by Stefan Behnel's avatar Stefan Behnel

extended test case to make sure the unicode method optimisations get applied

parent 57dddae0
...@@ -17,6 +17,8 @@ def print_all(l): ...@@ -17,6 +17,8 @@ def print_all(l):
# unicode.split(s, [sep, [maxsplit]]) # unicode.split(s, [sep, [maxsplit]])
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def split(unicode s): def split(unicode s):
""" """
>>> print_all( text.split() ) >>> print_all( text.split() )
...@@ -40,6 +42,8 @@ def split(unicode s): ...@@ -40,6 +42,8 @@ def split(unicode s):
""" """
return s.split() return s.split()
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def split_sep(unicode s, sep): def split_sep(unicode s, sep):
""" """
>>> print_all( text.split(sep) ) >>> print_all( text.split(sep) )
...@@ -57,7 +61,8 @@ def split_sep(unicode s, sep): ...@@ -57,7 +61,8 @@ def split_sep(unicode s, sep):
"//CoerceToPyTypeNode", "//CoerceToPyTypeNode",
"//CastNode", "//TypecastNode") "//CastNode", "//TypecastNode")
@cython.test_assert_path_exists( @cython.test_assert_path_exists(
"//CoerceFromPyTypeNode") "//CoerceFromPyTypeNode",
"//PythonCapiCallNode")
def split_sep_max(unicode s, sep, max): def split_sep_max(unicode s, sep, max):
""" """
>>> print_all( text.split(sep, 1) ) >>> print_all( text.split(sep, 1) )
...@@ -72,6 +77,8 @@ def split_sep_max(unicode s, sep, max): ...@@ -72,6 +77,8 @@ def split_sep_max(unicode s, sep, max):
@cython.test_fail_if_path_exists( @cython.test_fail_if_path_exists(
"//CoerceToPyTypeNode", "//CoerceFromPyTypeNode", "//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
"//CastNode", "//TypecastNode") "//CastNode", "//TypecastNode")
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def split_sep_max_int(unicode s, sep): def split_sep_max_int(unicode s, sep):
""" """
>>> print_all( text.split(sep, 1) ) >>> print_all( text.split(sep, 1) )
...@@ -86,6 +93,8 @@ def split_sep_max_int(unicode s, sep): ...@@ -86,6 +93,8 @@ def split_sep_max_int(unicode s, sep):
# unicode.splitlines(s, [keepends]) # unicode.splitlines(s, [keepends])
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def splitlines(unicode s): def splitlines(unicode s):
""" """
>>> len(multiline_text.splitlines()) >>> len(multiline_text.splitlines())
...@@ -103,6 +112,8 @@ def splitlines(unicode s): ...@@ -103,6 +112,8 @@ def splitlines(unicode s):
""" """
return s.splitlines() return s.splitlines()
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def splitlines_keep(unicode s, keep): def splitlines_keep(unicode s, keep):
""" """
>>> len(multiline_text.splitlines(True)) >>> len(multiline_text.splitlines(True))
...@@ -128,6 +139,8 @@ def splitlines_keep(unicode s, keep): ...@@ -128,6 +139,8 @@ def splitlines_keep(unicode s, keep):
# boolean conversion isn't currently smart enough for this ... # boolean conversion isn't currently smart enough for this ...
# "//CoerceToPyTypeNode", "//CoerceFromPyTypeNode", # "//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
"//CastNode", "//TypecastNode") "//CastNode", "//TypecastNode")
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def splitlines_keep_bint(unicode s): def splitlines_keep_bint(unicode s):
""" """
>>> len(multiline_text.splitlines(True)) >>> len(multiline_text.splitlines(True))
...@@ -162,6 +175,11 @@ def splitlines_keep_bint(unicode s): ...@@ -162,6 +175,11 @@ def splitlines_keep_bint(unicode s):
pipe_sep = u'|' pipe_sep = u'|'
@cython.test_fail_if_path_exists(
"//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
"//CastNode", "//TypecastNode")
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def join(unicode sep, l): def join(unicode sep, l):
""" """
>>> l = text.split() >>> l = text.split()
...@@ -174,6 +192,11 @@ def join(unicode sep, l): ...@@ -174,6 +192,11 @@ def join(unicode sep, l):
""" """
return sep.join(l) return sep.join(l)
@cython.test_fail_if_path_exists(
"//CoerceToPyTypeNode", "//CoerceFromPyTypeNode",
"//CastNode", "//TypecastNode", "//NoneCheckNode")
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def join_sep(l): def join_sep(l):
""" """
>>> l = text.split() >>> l = text.split()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment