Commit eabbb046 authored by Stefan Behnel's avatar Stefan Behnel

refactor test

parent 4104a516
__doc__ = u""" __doc__ = u"""
>>> c()
120
>>> i0() == -1
True
>>> i1() == 42
True
>>> i2() == 0x42
True
>>> i3() == -0x42
True
>>> l()
666
>>> f()
12.5
>>> s() >>> s()
b'spam' b'spam'
>>> two()
2
>>> five()
5
>>> true()
True
>>> false()
False
""" """
import sys import sys
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
__doc__ = __doc__.replace(u" b'", u" '") __doc__ = __doc__.replace(u" b'", u" '")
else:
__doc__ = __doc__.replace(u" 042", u" 0o42")
DEF TUPLE = (1, 2, u"buckle my shoe") DEF TUPLE = (1, 2, u"buckle my shoe")
DEF TRUE_FALSE = (True, False) DEF TRUE_FALSE = (True, False)
...@@ -50,54 +27,79 @@ DEF INT_TUPLE1 = TUPLE[:2] ...@@ -50,54 +27,79 @@ DEF INT_TUPLE1 = TUPLE[:2]
DEF INT_TUPLE2 = TUPLE[1:4:2] DEF INT_TUPLE2 = TUPLE[1:4:2]
def c(): def c():
cdef char c """
c = CHAR >>> c()
120
"""
cdef char c = CHAR
return c return c
def i0(): def i0():
cdef int i """
i = INT0 >>> i0() == -1
True
"""
cdef int i = INT0
return i return i
def i1(): def i1():
cdef int i """
i = INT1 >>> i1() == 42
True
"""
cdef int i = INT1
return i return i
def i2(): def i2():
cdef int i """
i = INT2 >>> i2() == 0x42
True
"""
cdef int i = INT2
return i return i
def i3(): def i3():
cdef int i """
i = INT3 >>> i3() == -0x42
True
"""
cdef int i = INT3
return i return i
def l(): def l():
cdef long l """
l = LONG >>> l()
666
"""
cdef long l = LONG
return l return l
def f(): def f():
cdef float f """
f = FLOAT >>> f()
12.5
"""
cdef float f = FLOAT
return f return f
def s(): def s():
cdef char *s """
s = STR see module docstring above
"""
cdef char* s = STR
return s return s
# this does not work! # this does not work!
#def t(): #def t():
# cdef object t # cdef object t = TUPLE
# t = TUPLE
# return t # return t
def two(): def two():
cdef int two """
two = TWO >>> two()
2
"""
cdef int two = TWO
return two return two
# this doesn't currently work! # this doesn't currently work!
...@@ -107,16 +109,25 @@ def two(): ...@@ -107,16 +109,25 @@ def two():
# return two # return two
def five(): def five():
cdef int five """
five = FIVE >>> five()
5
"""
cdef int five = FIVE
return five return five
def true(): def true():
cdef bint true """
true = TRUE >>> true()
True
"""
cdef bint true = TRUE
return true return true
def false(): def false():
cdef bint false """
false = FALSE >>> false()
False
"""
cdef bint false = FALSE
return 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