Commit d85651f2 authored by Stefan Behnel's avatar Stefan Behnel

enabled most remaining tests from the 'broken' directory

--HG--
rename : tests/broken/arraytoptrarg.pyx => tests/compile/arraytoptrarg.pyx
rename : tests/broken/ass2longlong.pyx => tests/compile/ass2longlong.pyx
rename : tests/broken/builtinfuncs.pyx => tests/compile/builtinfuncs.pyx
rename : tests/broken/cascmp.pyx => tests/compile/cascmp.pyx
rename : tests/broken/cassign.pyx => tests/compile/cassign.pyx
rename : tests/broken/casttoexttype.pyx => tests/compile/casttoexttype.pyx
rename : tests/broken/cnamespec.pyx => tests/compile/cnamespec.pyx
rename : tests/broken/cnumop.pyx => tests/compile/cnumop.pyx
rename : tests/broken/cunsignedlong.pyx => tests/compile/cunsignedlong.pyx
rename : tests/broken/del.pyx => tests/compile/del.pyx
rename : tests/broken/delslice.pyx => tests/compile/delslice.pyx
rename : tests/broken/drake1.pyx => tests/compile/drake1.pyx
rename : tests/broken/eqcmp.pyx => tests/compile/eqcmp.pyx
rename : tests/broken/ewing1.pyx => tests/compile/ewing1.pyx
rename : tests/broken/ewing5.pyx => tests/compile/ewing5.pyx
rename : tests/broken/excvalcheck.pyx => tests/compile/excvalcheck.pyx
rename : tests/broken/excvalreturn.pyx => tests/compile/excvalreturn.pyx
rename : tests/broken/extcoerce.pyx => tests/compile/extcoerce.pyx
rename : tests/broken/extdescrdel.pyx => tests/compile/extdescrdel.pyx
rename : tests/broken/extdescrget.pyx => tests/compile/extdescrget.pyx
rename : tests/broken/extdescrset.pyx => tests/compile/extdescrset.pyx
rename : tests/broken/extexttype.pyx => tests/compile/extexttype.pyx
rename : tests/broken/extgetitem.pyx => tests/compile/extgetitem.pyx
rename : tests/broken/extinheritdel.pyx => tests/compile/extinheritdel.pyx
rename : tests/broken/extinheritset.pyx => tests/compile/extinheritset.pyx
rename : tests/broken/extpropertyall.pyx => tests/compile/extpropertyall.pyx
rename : tests/broken/extpymemberdef.pyx => tests/compile/extpymemberdef.pyx
rename : tests/broken/forfromelse.pyx => tests/compile/forfromelse.pyx
rename : tests/broken/gencall.pyx => tests/compile/gencall.pyx
rename : tests/broken/globalstmt.pyx => tests/compile/globalstmt.pyx
rename : tests/broken/gustafsson2.pyx => tests/compile/gustafsson2.pyx
rename : tests/broken/index.pyx => tests/compile/index.pyx
rename : tests/broken/jiba5.pyx => tests/compile/jiba5.pyx
rename : tests/broken/jiba6.pyx => tests/compile/jiba6.pyx
rename : tests/broken/johnson1.pyx => tests/compile/johnson1.pyx
rename : tests/broken/magcmp.pyx => tests/compile/magcmp.pyx
rename : tests/broken/none.pyx => tests/compile/none.pyx
rename : tests/broken/notnonearg.pyx => tests/compile/notnonearg.pyx
rename : tests/broken/r_pernici1.pyx => tests/compile/r_pernici1.pyx
rename : tests/broken/slicex.pyx => tests/compile/slicex.pyx
rename : tests/broken/traceback.pyx => tests/compile/traceback.pyx
rename : tests/broken/watts2.pyx => tests/compile/watts2.pyx
rename : tests/broken/anonymousenum.pyx => tests/run/anonymousenum.pyx
rename : tests/broken/ass2cglobal.pyx => tests/run/ass2cglobal.pyx
rename : tests/broken/cstringmeth.pyx => tests/run/cstringmeth.pyx
rename : tests/broken/extcmethod.pyx => tests/run/extcmethod.pyx
rename : tests/broken/extpropertyref.pyx => tests/run/extpropertyref.pyx
rename : tests/broken/filenames.pxi => tests/run/filenames.pxi
rename : tests/broken/filenames.pyx => tests/run/filenames.pyx
rename : tests/broken/inhcmethcall.pyx => tests/run/inhcmethcall.pyx
rename : tests/broken/king1.pyx => tests/run/king1.pyx
rename : tests/broken/menten1.pyx => tests/run/menten1.pyx
rename : tests/broken/nononetypecheck.pyx => tests/run/nononetypecheck.pyx
rename : tests/broken/tandemstats.pyx => tests/run/tandemstats.pyx
rename : tests/broken/watts1.pyx => tests/run/watts1.pyx
parent 40979aa8
cdef int i
cdef x
def f(a):
global i, x
i = 42
x = a
cdef class Parrot:
cdef void describe(self):
pass
cdef class Norwegian(Parrot):
cdef void describe(self):
Parrot.describe(self)
......@@ -4,7 +4,6 @@ cdef void foo():
cdef char *ptr1, *ptr2
cdef int *ptr3
bool = int1 == int2
bool = int1 <> int2
bool = int1 != int2
bool = float1 == float2
bool = ptr1 == ptr2
......
......@@ -3,12 +3,6 @@ cdef class Grail:
def __add__(int x, float y):
pass
def __getslice__(self, i, j):
pass
def __setslice__(self, Py_ssize_t i, float j, x):
pass
cdef class Swallow:
pass
......
......@@ -6,9 +6,6 @@ cdef class Norwegian(Parrot):
def __delitem__(self, i):
pass
def __delslice__(self, i, j):
pass
def __delattr__(self, n):
pass
......
......@@ -6,9 +6,6 @@ cdef class Norwegian(Parrot):
def __setitem__(self, i, x):
pass
def __setslice__(self, i, j, x):
pass
def __setattr__(self, n, x):
pass
......
struct Tomato { PyObject_HEAD}; struct Bicycle{ PyObject_HEAD};
\ No newline at end of file
__doc__ = u"""
>>> main()
3.14159265358979323846
3.14159265358979323846
3.14159265358979323846
"""
cdef extern from "math.h":
double M_PI
......
__doc__ = u"""
>>> p
42
"""
cdef enum:
spam = 42
grail = 17
......@@ -5,3 +10,4 @@ cdef enum:
cdef int i
i = spam
p = i
__doc__ = u"""
>>> what()
0 5
>>> f(5)
>>> what()
42 5
>>> f(6)
>>> what()
42 6
>>> f("spam")
>>> what()
42 spam
"""
cdef int i = 0
cdef x = 5
def f(a):
global i, x
i = 42
x = a
def what():
print i,x
__doc__ = u"""
>>> y
(b'1', b'2', b'3')
>>> x
b'1foo2foo3'
"""
import sys
if sys.version_info[0] < 3:
__doc__ = __doc__.replace(u"b'", u"'")
y = ('1','2','3')
x = 'foo'.join(y)
__doc__ = u"""
>>> test()
5
0
20
5
"""
cdef class Spam:
cdef int tons
......@@ -8,8 +16,27 @@ cdef class Spam:
cdef void eat(self):
self.tons = 0
def lift(self):
print self.tons
cdef class SuperSpam(Spam):
cdef void add_tons(self, int x):
self.tons = self.tons + 2 * x
def test():
cdef Spam s
cdef SuperSpam ss
s = Spam()
s.eat()
s.add_tons(5)
s.lift()
ss = SuperSpam()
ss.eat()
ss.lift()
ss.add_tons(10)
ss.lift()
s.lift()
__doc__ = u"""
>>> tomato()
42
"""
cdef class Spam:
property eggs:
def __get__(self):
pass
return 42
cdef void tomato():
def tomato():
cdef Spam spam
cdef object lettuce
spam = Spam()
lettuce = spam.eggs
return lettuce
__doc__ = u"""
>>> print(spam)
ftang
>>> foo
42
"""
include "filenames.pxi"
foo = 42
......
__doc__ = u"""
>>> p = Norwegian()
>>> p.describe()
Norwegian
Parrot
"""
cdef class Parrot:
cdef void _describe(self):
print u"Parrot"
def describe(self):
self._describe()
cdef class Norwegian(Parrot):
cdef void _describe(self):
print u"Norwegian"
Parrot._describe(self)
__doc__ = u"""
>>> f()
It works!
"""
DEF STUFF = "Spam"
cdef void f():
def f():
IF STUFF == "Spam":
print "It works!"
print u"It works!"
ELSE:
print "Doesn't work"
print u"Doesn't work"
cdef loops():
__doc__ = u"""
>>> loops()
5
"""
def loops():
cdef int k
for i from 0 <= i < 5:
for j from 0 <= j < 2:
k = i + j
return k
__doc__ = u"""
>>> g()
"""
cdef class Spam:
pass
cdef f(Spam s):
pass
cdef g():
def g():
f(None)
__doc__ = u"""
>>> result() == (99, 17*42, 17*42)
True
"""
cdef int i, j, k
i = 17; j = 42; k = i * j
if j > k: i = 88
else: i = 99; j = k
def result():
return (i,j,k)
__doc__ = u"""
>>> test() == 55 + 66
True
"""
def test():
cdef int a,b
foo=(55,66)
a,b=foo
return a + b
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