blob: b119de9753944f6bc3e3b4e4259a846a217fe14c [file] [log] [blame]
Wenzel Jakob38bd7112015-07-05 20:05:44 +02001#!/usr/bin/env python3
2import sys
3sys.path.append('.')
4
5from example import Pet
6from example import Dog
7from example import dog_bark
8from example import pet_print
9
10polly = Pet('Polly', 'parrot')
11molly = Dog('Molly')
12print(polly.name() + " is a " + polly.species())
13pet_print(polly)
14print(molly.name() + " is a " + molly.species())
15pet_print(molly)
16dog_bark(molly)
17try:
18 dog_bark(polly)
19except Exception as e:
20 print('The following error is expected: ' + str(e))
21
22from example import test_callback1
23from example import test_callback2
24from example import test_callback3
25from example import Example5
26
27def func1():
28 print('Callback function 1 called!')
29
30def func2(a, b, c):
31 print('Callback function 2 called : ' + str(a) + ", " + str(b) + ", "+ str(c))
32 return c
33
34class MyCallback(Example5):
35 def __init__(self, value):
36 Example5.__init__(self, self, value)
37
38 def callback(self, value1, value2):
39 print('got callback: %i %i' % (value1, value2))
40
41print(test_callback1(func1))
42print(test_callback2(func2))
43
44callback = MyCallback(3)
45test_callback3(callback, 4)