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
d10bcdbb
Commit
d10bcdbb
authored
Oct 30, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3 doctest fix
parent
6787f000
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
tests/run/cdivision_CEP_516.pyx
tests/run/cdivision_CEP_516.pyx
+15
-5
No files found.
tests/run/cdivision_CEP_516.pyx
View file @
d10bcdbb
...
@@ -31,12 +31,16 @@ True
...
@@ -31,12 +31,16 @@ True
True
True
>>> all([div_int_py(a,b) == a // b for a in range(-10, 10) for b in range(-10, 10) if b != 0])
>>> all([div_int_py(a,b) == a // b for a in range(-10, 10) for b in range(-10, 10) if b != 0])
True
True
"""
>>> def simple_warn(msg, *args): print(msg)
import
warnings
>>> import warnings
orig_showwarning
=
warnings
.
showwarning
>>> warnings.showwarning = simple_warn
true_py_functions
=
{}
exec
"def simple_warn(msg, *args): print(msg)"
in
true_py_functions
simple_warn
=
true_py_functions
[
'simple_warn'
]
del
true_py_functions
"""
def
_all
(
seq
):
def
_all
(
seq
):
for
x
in
seq
:
for
x
in
seq
:
...
@@ -100,9 +104,11 @@ def test_cdiv_cmod(short a, short b):
...
@@ -100,9 +104,11 @@ def test_cdiv_cmod(short a, short b):
@
cython
.
cdivision_warnings
(
True
)
@
cython
.
cdivision_warnings
(
True
)
def
mod_int_c_warn
(
int
a
,
int
b
):
def
mod_int_c_warn
(
int
a
,
int
b
):
"""
"""
>>> warnings.showwarning = simple_warn
>>> mod_int_c_warn(-17, 10)
>>> mod_int_c_warn(-17, 10)
division with oppositely signed operands, C and Python semantics differ
division with oppositely signed operands, C and Python semantics differ
-7
-7
>>> warnings.showwarning = orig_showwarning
"""
"""
return
a
%
b
return
a
%
b
...
@@ -110,9 +116,11 @@ def mod_int_c_warn(int a, int b):
...
@@ -110,9 +116,11 @@ def mod_int_c_warn(int a, int b):
@
cython
.
cdivision_warnings
(
True
)
@
cython
.
cdivision_warnings
(
True
)
def
div_int_c_warn
(
int
a
,
int
b
):
def
div_int_c_warn
(
int
a
,
int
b
):
"""
"""
>>> warnings.showwarning = simple_warn
>>> div_int_c_warn(-17, 10)
>>> div_int_c_warn(-17, 10)
division with oppositely signed operands, C and Python semantics differ
division with oppositely signed operands, C and Python semantics differ
-1
-1
>>> warnings.showwarning = orig_showwarning
"""
"""
return
a
//
b
return
a
//
b
...
@@ -120,12 +128,14 @@ def div_int_c_warn(int a, int b):
...
@@ -120,12 +128,14 @@ def div_int_c_warn(int a, int b):
@
cython
.
cdivision_warnings
(
True
)
@
cython
.
cdivision_warnings
(
True
)
def
complex_expression
(
int
a
,
int
b
,
int
c
,
int
d
):
def
complex_expression
(
int
a
,
int
b
,
int
c
,
int
d
):
"""
"""
>>> warnings.showwarning = simple_warn
>>> complex_expression(-150, 20, 19, -7)
>>> complex_expression(-150, 20, 19, -7)
verbose_call(20)
verbose_call(20)
division with oppositely signed operands, C and Python semantics differ
division with oppositely signed operands, C and Python semantics differ
verbose_call(19)
verbose_call(19)
division with oppositely signed operands, C and Python semantics differ
division with oppositely signed operands, C and Python semantics differ
-2
-2
>>> warnings.showwarning = orig_showwarning
"""
"""
return
(
a
//
verbose_call
(
b
))
%
(
verbose_call
(
c
)
//
d
)
return
(
a
//
verbose_call
(
b
))
%
(
verbose_call
(
c
)
//
d
)
...
...
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