Skip to content

Commit

Permalink
More elaborate test for interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Colomiets committed Oct 6, 2010
1 parent a317ad5 commit 82a2ebb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/testpy.py
Expand Up @@ -594,14 +594,27 @@ def buy(self, name):
def die(self):
return 'rip'

class Parrot(A, IAnimal):
def __init__(self):
pass

def cry(self):
return "Popka durak"

def buy(self, name):
return "Parrot's "+name

def die(self):
return 'rip'

class TestClass(Test):
def __init__(self, reporter, name):
super().__init__(reporter, name)

def test(self):
self.testOverride()
self.testStatic()
self.testSlots()
#~ self.testSlots()
self.testClassmethods()
self.testInterface()

Expand Down Expand Up @@ -677,6 +690,11 @@ def testInterface(self):
self.assertEquals(chick.buy('food'), "Chicken's food")
self.assertEquals(chick.die(), 'rip')
self.assertTrue(isinstance(chick, IAnimal))
parrot = Parrot()
self.assertEquals(parrot.cry(), 'Popka durak')
self.assertEquals(parrot.hello(), 'hello')
self.assertTrue(isinstance(parrot, IAnimal))


def global_fun(a, b):
return (a+b)*(a-b)
Expand Down

0 comments on commit 82a2ebb

Please sign in to comment.