PageRenderTime 56ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/test-suite/python/cpp_namespace_runme.py

#
Python | 45 lines | 29 code | 15 blank | 1 comment | 10 complexity | dc23d1ab29eff1653821ea7737f6087d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # Note: This example assumes that namespaces are flattened
  2. import cpp_namespace
  3. n = cpp_namespace.fact(4)
  4. if n != 24:
  5. raise "Bad return value!"
  6. if cpp_namespace.cvar.Foo != 42:
  7. raise "Bad variable value!"
  8. t = cpp_namespace.Test()
  9. if t.method() != "Test::method":
  10. raise "Bad method return value!"
  11. if cpp_namespace.do_method(t) != "Test::method":
  12. raise "Bad return value!"
  13. if cpp_namespace.do_method2(t) != "Test::method":
  14. raise "Bad return value!"
  15. cpp_namespace.weird("hello", 4)
  16. del t
  17. t2 = cpp_namespace.Test2()
  18. t3 = cpp_namespace.Test3()
  19. t4 = cpp_namespace.Test4()
  20. t5 = cpp_namespace.Test5()
  21. if cpp_namespace.foo3(42) != 42:
  22. raise "Bad return value!"
  23. if cpp_namespace.do_method3(t2,40) != "Test2::method":
  24. raise "Bad return value!"
  25. if cpp_namespace.do_method3(t3,40) != "Test3::method":
  26. raise "Bad return value!"
  27. if cpp_namespace.do_method3(t4,40) != "Test4::method":
  28. raise "Bad return value!"
  29. if cpp_namespace.do_method3(t5,40) != "Test5::method":
  30. raise "Bad return value!"