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
Kirill Smelkov
cython
Commits
b3635f53
Commit
b3635f53
authored
Apr 22, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended test cases
parent
4fba3bc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
+56
-4
tests/run/inop.pyx
tests/run/inop.pyx
+30
-4
tests/run/notinop.pyx
tests/run/notinop.pyx
+26
-0
No files found.
tests/run/inop.pyx
View file @
b3635f53
...
@@ -92,7 +92,7 @@ def m_set(int a):
...
@@ -92,7 +92,7 @@ def m_set(int a):
cdef
int
result
=
a
in
{
1
,
2
,
3
,
4
}
cdef
int
result
=
a
in
{
1
,
2
,
3
,
4
}
return
result
return
result
cdef
bytes
bytes_string
=
b'ab
cdef
g'
cdef
bytes
bytes_string
=
b'ab
\
0
cde
\
0
f
\
0
g'
py_bytes_string
=
bytes_string
py_bytes_string
=
bytes_string
@
cython
.
test_assert_path_exists
(
"//PrimaryCmpNode"
)
@
cython
.
test_assert_path_exists
(
"//PrimaryCmpNode"
)
...
@@ -122,10 +122,10 @@ def m_bytes_literal(char a):
...
@@ -122,10 +122,10 @@ def m_bytes_literal(char a):
>>> m_bytes_literal(ord('X'))
>>> m_bytes_literal(ord('X'))
0
0
"""
"""
cdef
int
result
=
a
in
b'ab
cdef
g'
cdef
int
result
=
a
in
b'ab
\
0
cde
\
0
f
\
0
g'
return
result
return
result
cdef
unicode
unicode_string
=
u'abcdefg
\
u1234
\
uF8D2
'
cdef
unicode
unicode_string
=
u'abc
\
0
defg
\
u1234
\
uF8D2
'
py_unicode_string
=
unicode_string
py_unicode_string
=
unicode_string
@
cython
.
test_assert_path_exists
(
"//PrimaryCmpNode"
)
@
cython
.
test_assert_path_exists
(
"//PrimaryCmpNode"
)
...
@@ -162,7 +162,7 @@ def m_unicode_literal(Py_UNICODE a):
...
@@ -162,7 +162,7 @@ def m_unicode_literal(Py_UNICODE a):
>>> m_unicode_literal(ord(py_klingon_character))
>>> m_unicode_literal(ord(py_klingon_character))
1
1
"""
"""
cdef
int
result
=
a
in
u'abcdefg
\
u1234
\
uF8D2
'
cdef
int
result
=
a
in
u'abc
\
0
defg
\
u1234
\
uF8D2
'
return
result
return
result
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
...
@@ -191,6 +191,32 @@ def conditional_object(int a):
...
@@ -191,6 +191,32 @@ def conditional_object(int a):
"""
"""
return
1
if
a
in
(
1
,
2
,
3
,
4
)
else
'2'
return
1
if
a
in
(
1
,
2
,
3
,
4
)
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_bytes
(
char
a
):
"""
>>> conditional_bytes(ord('a'))
1
>>> conditional_bytes(ord('X'))
'2'
>>> conditional_bytes(0)
'2'
"""
return
1
if
a
in
b'abc'
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_unicode
(
Py_UNICODE
a
):
"""
>>> conditional_unicode(ord('a'))
1
>>> conditional_unicode(ord('X'))
'2'
>>> conditional_unicode(0)
'2'
"""
return
1
if
a
in
u'abc'
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_none
(
int
a
):
def
conditional_none
(
int
a
):
...
...
tests/run/notinop.pyx
View file @
b3635f53
...
@@ -242,6 +242,32 @@ def conditional_object(int a):
...
@@ -242,6 +242,32 @@ def conditional_object(int a):
"""
"""
return
1
if
a
not
in
(
1
,
2
,
3
,
4
)
else
'2'
return
1
if
a
not
in
(
1
,
2
,
3
,
4
)
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_bytes
(
char
a
):
"""
>>> conditional_bytes(ord('a'))
'2'
>>> conditional_bytes(ord('X'))
1
>>> conditional_bytes(0)
1
"""
return
1
if
a
not
in
b'abc'
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_unicode
(
Py_UNICODE
a
):
"""
>>> conditional_unicode(ord('a'))
'2'
>>> conditional_unicode(ord('X'))
1
>>> conditional_unicode(0)
1
"""
return
1
if
a
not
in
u'abc'
else
'2'
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_assert_path_exists
(
"//SwitchStatNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
@
cython
.
test_fail_if_path_exists
(
"//BoolBinopNode"
,
"//PrimaryCmpNode"
)
def
conditional_none
(
int
a
):
def
conditional_none
(
int
a
):
...
...
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