Commit eabbb046 authored by Stefan Behnel's avatar Stefan Behnel

refactor test

parent 4104a516
__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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment