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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
91ffc474
Commit
91ffc474
authored
Jul 11, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new test case for flattened 'in' tests
parent
a39c09ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
tests/run/flatin.pyx
tests/run/flatin.pyx
+47
-0
No files found.
tests/run/flatin.pyx
0 → 100644
View file @
91ffc474
__doc__
=
u"""
>>> test_in('ABC')
1
>>> test_in('abc')
2
>>> test_in('X')
3
>>> test_in('XYZ')
4
>>> test_in('ABCXYZ')
5
>>> test_in('')
5
>>> test_not_in('abc')
1
>>> test_not_in('CDE')
2
>>> test_not_in('CDEF')
3
>>> test_not_in('BCD')
4
"""
def
test_in
(
s
):
if
s
in
(
'ABC'
,
'BCD'
):
return
1
elif
s
.
upper
()
in
(
'ABC'
,
'BCD'
):
return
2
elif
len
(
s
)
in
(
1
,
2
):
return
3
elif
len
(
s
)
in
(
3
,
4
):
return
4
else
:
return
5
def
test_not_in
(
s
):
if
s
not
in
(
'ABC'
,
'BCD'
,
'CDE'
,
'CDEF'
):
return
1
elif
s
.
upper
()
not
in
(
'ABC'
,
'BCD'
,
'CDEF'
):
return
2
elif
len
(
s
)
not
in
[
3
]:
return
3
elif
len
(
s
)
not
in
[
1
,
2
]:
return
4
else
:
return
5
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