Commit bdb3551b authored by Stefan Behnel's avatar Stefan Behnel

test fixes and extensions

parent 57773d75
cimport cython
b_a = b'a'
b_b = b'b'
@cython.test_assert_path_exists(
"//PythonCapiCallNode")
def bytes_startswith(bytes s, sub, start=None, stop=None):
"""
>>> bytes_startswith(b'a', b'a')
>>> bytes_startswith(b_a, b_a)
True
>>> bytes_startswith(b_a+b_b, b_a)
True
>>> bytes_startswith(b'a', b'b')
>>> bytes_startswith(b_a, b_b)
False
>>> bytes_startswith(b_a+b_b, b_b)
False
>>> bytes_startswith(b'a', (b'a', b'b'))
>>> bytes_startswith(b_a, (b_a, b_b))
True
>>> bytes_startswith(b'a', b'a', 1)
>>> bytes_startswith(b_a, b_a, 1)
False
>>> bytes_startswith(b'a', b'a', 0, 0)
>>> bytes_startswith(b_a, b_a, 0, 0)
False
"""
......@@ -27,15 +34,19 @@ def bytes_startswith(bytes s, sub, start=None, stop=None):
"//PythonCapiCallNode")
def bytes_endswith(bytes s, sub, start=None, stop=None):
"""
>>> bytes_endswith(b'a', b'a')
>>> bytes_endswith(b_a, b_a)
True
>>> bytes_endswith(b'a', b'b')
>>> bytes_endswith(b_b+b_a, b_a)
True
>>> bytes_endswith(b_a, b_b)
False
>>> bytes_endswith(b_b+b_a, b_b)
False
>>> bytes_endswith(b'a', (b'a', b'b'))
>>> bytes_endswith(b_a, (b_a, b_b))
True
>>> bytes_endswith(b'a', b'a', 1)
>>> bytes_endswith(b_a, b_a, 1)
False
>>> bytes_endswith(b'a', b'a', 0, 0)
>>> bytes_endswith(b_a, b_a, 0, 0)
False
"""
......
......@@ -6,8 +6,12 @@ def str_startswith(str s, sub, start=None, stop=None):
"""
>>> str_startswith('a', 'a')
True
>>> str_startswith('ab', 'a')
True
>>> str_startswith('a', 'b')
False
>>> str_startswith('ab', 'b')
False
>>> str_startswith('a', ('a', 'b'))
True
>>> str_startswith('a', 'a', 1)
......@@ -29,8 +33,12 @@ def str_endswith(str s, sub, start=None, stop=None):
"""
>>> str_endswith('a', 'a')
True
>>> str_endswith('ba', 'a')
True
>>> str_endswith('a', 'b')
False
>>> str_endswith('ba', 'b')
False
>>> str_endswith('a', ('a', 'b'))
True
>>> str_endswith('a', 'a', 1)
......
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