PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/python/director_detect_runme.py

#
Python | 36 lines | 25 code | 11 blank | 0 comment | 3 complexity | 9e7bcdaa51a9d2b1c139c21c742cdd2d MD5 | raw file
 1import director_detect 
 2
 3class MyBar(director_detect.Bar):
 4  def __init__(self, val = 2):
 5    director_detect.Bar.__init__(self)
 6    self.val = val
 7
 8  def get_value(self):
 9    self.val = self.val + 1
10    return self.val
11  
12  def get_class(self):
13    self.val = self.val + 1
14    return director_detect.A()
15
16  def just_do_it(self):
17    self.val = self.val + 1
18
19  def clone(self):
20    return MyBar(self.val)
21  pass
22
23
24b = MyBar()
25
26f = b.baseclass()
27
28v = f.get_value()
29a = f.get_class()
30f.just_do_it()
31
32c = b.clone()
33vc = c.get_value()
34
35if (v != 3) or (b.val != 5) or (vc != 6):
36  raise RuntimeError,"Bad virtual detection"