Commit cf42b0a0 authored by Stefan Behnel's avatar Stefan Behnel

clean up test a little

--HG--
extra : rebase_source : 7b763fbb0f2485056ec4d2f53a5ec76dc7be9203
parent 80a05e8f
# mode: run
cdef class Spam: cdef class Spam:
cdef int tons cdef int tons
cdef void add_tons(self, int x): cdef void add_tons(self, int x):
self.tons = self.tons + x self.tons += x
cdef void eat(self): cdef void eat(self):
self.tons = 0 self.tons = 0
...@@ -11,10 +13,10 @@ cdef class Spam: ...@@ -11,10 +13,10 @@ cdef class Spam:
def lift(self): def lift(self):
print self.tons print self.tons
cdef class SuperSpam(Spam): cdef class SubSpam(Spam):
cdef void add_tons(self, int x): cdef void add_tons(self, int x):
self.tons = self.tons + 2 * x self.tons += 2 * x
def test(): def test():
""" """
...@@ -25,13 +27,13 @@ def test(): ...@@ -25,13 +27,13 @@ def test():
5 5
""" """
cdef Spam s cdef Spam s
cdef SuperSpam ss cdef SubSpam ss
s = Spam() s = Spam()
s.eat() s.eat()
s.add_tons(5) s.add_tons(5)
s.lift() s.lift()
ss = SuperSpam() ss = SubSpam()
ss.eat() ss.eat()
ss.lift() ss.lift()
......
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