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
f7cd93f2
Commit
f7cd93f2
authored
Nov 11, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved test for cascaded comparison coercions
parent
a6abc089
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
tests/run/inop.pyx
tests/run/inop.pyx
+24
-1
No files found.
tests/run/inop.pyx
View file @
f7cd93f2
...
...
@@ -377,12 +377,17 @@ def test_inop_cascaded(x):
"""
return
1
!=
x
in
[
2
]
### The following tests are copied from CPython's test_grammar.py.
### They look stupid, but the nice thing about them is that Cython
### treats '1' as a C integer constant that triggers Python object
### coercion for the 'in' operator here, whereas the left side of
### the cascade can be evaluated entirely in C space.
def
test_inop_cascaded_one
():
"""
>>> test_inop_cascaded_one()
False
"""
# copied from CPython's test_grammar.py
return
1
<
1
>
1
==
1
>=
1
<=
1
!=
1
in
1
not
in
1
is
1
is
not
1
def
test_inop_cascaded_int_orig
(
int
x
):
...
...
@@ -392,6 +397,24 @@ def test_inop_cascaded_int_orig(int x):
"""
return
1
<
1
>
1
==
1
>=
1
<=
1
!=
x
in
1
not
in
1
is
1
is
not
1
def
test_inop_cascaded_one_err
():
"""
>>> test_inop_cascaded_one_err() # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError:... itera...
"""
return
1
==
1
>=
1
<=
1
in
1
not
in
1
is
1
is
not
1
def
test_inop_cascaded_int_orig_err
(
int
x
):
"""
>>> test_inop_cascaded_int_orig_err(1) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError:... itera...
"""
return
1
==
1
>=
1
<=
1
==
x
in
1
not
in
1
is
1
is
not
1
###
def
test_inop_cascaded_int
(
int
x
):
"""
>>> test_inop_cascaded_int(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