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
eabbb046
Commit
eabbb046
authored
Feb 13, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor test
parent
4104a516
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
50 deletions
+61
-50
tests/run/ct_DEF.pyx
tests/run/ct_DEF.pyx
+61
-50
No files found.
tests/run/ct_DEF.pyx
View file @
eabbb046
__doc__
=
u"""
>>> c()
120
>>> i0() == -1
True
>>> i1() == 42
True
>>> i2() == 0x42
True
>>> i3() == -0x42
True
>>> l()
666
>>> f()
12.5
>>> s()
b'spam'
>>> two()
2
>>> five()
5
>>> true()
True
>>> false()
False
"""
import
sys
if
sys
.
version_info
[
0
]
<
3
:
__doc__
=
__doc__
.
replace
(
u" b'"
,
u" '"
)
else
:
__doc__
=
__doc__
.
replace
(
u" 042"
,
u" 0o42"
)
DEF
TUPLE
=
(
1
,
2
,
u"buckle my shoe"
)
DEF
TRUE_FALSE
=
(
True
,
False
)
...
...
@@ -50,54 +27,79 @@ DEF INT_TUPLE1 = TUPLE[:2]
DEF
INT_TUPLE2
=
TUPLE
[
1
:
4
:
2
]
def
c
():
cdef
char
c
c
=
CHAR
"""
>>> c()
120
"""
cdef
char
c
=
CHAR
return
c
def
i0
():
cdef
int
i
i
=
INT0
"""
>>> i0() == -1
True
"""
cdef
int
i
=
INT0
return
i
def
i1
():
cdef
int
i
i
=
INT1
"""
>>> i1() == 42
True
"""
cdef
int
i
=
INT1
return
i
def
i2
():
cdef
int
i
i
=
INT2
"""
>>> i2() == 0x42
True
"""
cdef
int
i
=
INT2
return
i
def
i3
():
cdef
int
i
i
=
INT3
"""
>>> i3() == -0x42
True
"""
cdef
int
i
=
INT3
return
i
def
l
():
cdef
long
l
l
=
LONG
"""
>>> l()
666
"""
cdef
long
l
=
LONG
return
l
def
f
():
cdef
float
f
f
=
FLOAT
"""
>>> f()
12.5
"""
cdef
float
f
=
FLOAT
return
f
def
s
():
cdef
char
*
s
s
=
STR
"""
see module docstring above
"""
cdef
char
*
s
=
STR
return
s
# this does not work!
#def t():
# cdef object t
# t = TUPLE
# cdef object t = TUPLE
# return t
def
two
():
cdef
int
two
two
=
TWO
"""
>>> two()
2
"""
cdef
int
two
=
TWO
return
two
# this doesn't currently work!
...
...
@@ -107,16 +109,25 @@ def two():
# return two
def
five
():
cdef
int
five
five
=
FIVE
"""
>>> five()
5
"""
cdef
int
five
=
FIVE
return
five
def
true
():
cdef
bint
true
true
=
TRUE
"""
>>> true()
True
"""
cdef
bint
true
=
TRUE
return
true
def
false
():
cdef
bint
false
false
=
FALSE
"""
>>> false()
False
"""
cdef
bint
false
=
FALSE
return
false
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