Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
bdb3551b
Commit
bdb3551b
authored
May 30, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test fixes and extensions
parent
57773d75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
+29
-10
tests/run/bytesmethods.pyx
tests/run/bytesmethods.pyx
+21
-10
tests/run/strmethods.pyx
tests/run/strmethods.pyx
+8
-0
No files found.
tests/run/bytesmethods.pyx
View file @
bdb3551b
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
"""
...
...
tests/run/strmethods.pyx
View file @
bdb3551b
...
...
@@ -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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment