PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import director_detect
  2. class MyBar(director_detect.Bar):
  3. def __init__(self, val = 2):
  4. director_detect.Bar.__init__(self)
  5. self.val = val
  6. def get_value(self):
  7. self.val = self.val + 1
  8. return self.val
  9. def get_class(self):
  10. self.val = self.val + 1
  11. return director_detect.A()
  12. def just_do_it(self):
  13. self.val = self.val + 1
  14. def clone(self):
  15. return MyBar(self.val)
  16. pass
  17. b = MyBar()
  18. f = b.baseclass()
  19. v = f.get_value()
  20. a = f.get_class()
  21. f.just_do_it()
  22. c = b.clone()
  23. vc = c.get_value()
  24. if (v != 3) or (b.val != 5) or (vc != 6):
  25. raise RuntimeError,"Bad virtual detection"