Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / test-suite / python / director_nested_runme.py
1 from director_nested import *
2
3
4 class A(FooBar_int):
5   def do_step(self):
6     return "A::do_step;"
7   
8   def get_value(self):
9     return "A::get_value"
10
11   pass
12
13
14 a = A()
15 if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
16   raise RuntimeError,"Bad A virtual resolution"
17
18
19 class B(FooBar_int):
20   def do_advance(self):
21     return "B::do_advance;" + self.do_step()
22
23   def do_step(self):
24     return "B::do_step;"
25   
26   def get_value(self):
27     return 1
28
29   pass
30
31
32 b = B()
33
34 if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
35   raise RuntimeError,"Bad B virtual resolution"
36
37
38
39 class C(FooBar_int):
40   def do_advance(self):
41     return "C::do_advance;" + FooBar_int.do_advance(self)
42
43   def do_step(self):
44     return "C::do_step;"
45   
46   def get_value(self):
47     return 2
48
49   def get_name(self):
50     return FooBar_int.get_name(self) + " hello"
51
52   
53   pass
54
55 cc = C()
56 c = FooBar_int_get_self(cc)
57 c.advance()
58
59 if c.get_name() != "FooBar::get_name hello":
60   raise RuntimeError
61
62 if c.name() != "FooBar::get_name hello":
63   raise RuntimeError