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(): ...@@ -4,7 +4,6 @@ cdef void foo():
cdef char *ptr1, *ptr2 cdef char *ptr1, *ptr2
cdef int *ptr3 cdef int *ptr3
bool = int1 == int2 bool = int1 == int2
bool = int1 <> int2
bool = int1 != int2 bool = int1 != int2
bool = float1 == float2 bool = float1 == float2
bool = ptr1 == ptr2 bool = ptr1 == ptr2
......
...@@ -2,12 +2,6 @@ cdef class Grail: ...@@ -2,12 +2,6 @@ cdef class Grail:
def __add__(int x, float y): def __add__(int x, float y):
pass pass
def __getslice__(self, i, j):
pass
def __setslice__(self, Py_ssize_t i, float j, x):
pass
cdef class Swallow: cdef class Swallow:
pass pass
......
...@@ -5,9 +5,6 @@ cdef class Norwegian(Parrot): ...@@ -5,9 +5,6 @@ cdef class Norwegian(Parrot):
def __delitem__(self, i): def __delitem__(self, i):
pass pass
def __delslice__(self, i, j):
pass
def __delattr__(self, n): def __delattr__(self, n):
pass pass
......
...@@ -5,9 +5,6 @@ cdef class Norwegian(Parrot): ...@@ -5,9 +5,6 @@ cdef class Norwegian(Parrot):
def __setitem__(self, i, x): def __setitem__(self, i, x):
pass pass
def __setslice__(self, i, j, x):
pass
def __setattr__(self, n, x): def __setattr__(self, n, x):
pass 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": cdef extern from "math.h":
double M_PI double M_PI
......
__doc__ = u"""
>>> p
42
"""
cdef enum: cdef enum:
spam = 42 spam = 42
grail = 17 grail = 17
...@@ -5,3 +10,4 @@ cdef enum: ...@@ -5,3 +10,4 @@ cdef enum:
cdef int i cdef int i
i = spam 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 class Spam:
cdef int tons cdef int tons
...@@ -8,8 +16,27 @@ cdef class Spam: ...@@ -8,8 +16,27 @@ cdef class Spam:
cdef void eat(self): cdef void eat(self):
self.tons = 0 self.tons = 0
def lift(self):
print self.tons
cdef class SuperSpam(Spam): cdef class SuperSpam(Spam):
cdef void add_tons(self, int x): cdef void add_tons(self, int x):
self.tons = self.tons + 2 * 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: cdef class Spam:
property eggs: property eggs:
def __get__(self): def __get__(self):
pass return 42
cdef void tomato(): def tomato():
cdef Spam spam cdef Spam spam
cdef object lettuce cdef object lettuce
spam = Spam()
lettuce = spam.eggs lettuce = spam.eggs
return lettuce
__doc__ = u"""
>>> print(spam)
ftang
>>> foo
42
"""
include "filenames.pxi" include "filenames.pxi"
foo = 42 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" DEF STUFF = "Spam"
cdef void f(): def f():
IF STUFF == "Spam": IF STUFF == "Spam":
print "It works!" print u"It works!"
ELSE: ELSE:
print "Doesn't work" print u"Doesn't work"
cdef loops(): __doc__ = u"""
>>> loops()
5
"""
def loops():
cdef int k cdef int k
for i from 0 <= i < 5: for i from 0 <= i < 5:
for j from 0 <= j < 2: for j from 0 <= j < 2:
k = i + j k = i + j
return k
__doc__ = u"""
>>> g()
"""
cdef class Spam: cdef class Spam:
pass pass
cdef f(Spam s): cdef f(Spam s):
pass pass
cdef g(): def g():
f(None) f(None)
__doc__ = u"""
>>> result() == (99, 17*42, 17*42)
True
"""
cdef int i, j, k cdef int i, j, k
i = 17; j = 42; k = i * j i = 17; j = 42; k = i * j
if j > k: i = 88 if j > k: i = 88
else: i = 99; j = k else: i = 99; j = k
def result():
return (i,j,k)
__doc__ = u"""
>>> test() == 55 + 66
True
"""
def test(): def test():
cdef int a,b cdef int a,b
foo=(55,66) foo=(55,66)
a,b=foo 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