PageRenderTime 12ms CodeModel.GetById 4ms app.highlight 7ms 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
 2import cpp_namespace
 3
 4n = cpp_namespace.fact(4)
 5if n != 24:
 6    raise "Bad return value!"
 7
 8if cpp_namespace.cvar.Foo != 42:
 9    raise "Bad variable value!"
10
11t = cpp_namespace.Test()
12if t.method() != "Test::method":
13    raise "Bad method return value!"
14
15if cpp_namespace.do_method(t) != "Test::method":
16    raise "Bad return value!"
17
18if cpp_namespace.do_method2(t) != "Test::method":
19    raise "Bad return value!"
20    
21cpp_namespace.weird("hello", 4)
22
23del t
24
25t2 = cpp_namespace.Test2()
26t3 = cpp_namespace.Test3()
27t4 = cpp_namespace.Test4()
28t5 = cpp_namespace.Test5()
29
30if cpp_namespace.foo3(42) != 42:
31    raise "Bad return value!"
32
33if cpp_namespace.do_method3(t2,40) != "Test2::method":
34    raise "Bad return value!"
35
36if cpp_namespace.do_method3(t3,40) != "Test3::method":
37    raise "Bad return value!"
38
39if cpp_namespace.do_method3(t4,40) != "Test4::method":
40    raise "Bad return value!"
41
42if cpp_namespace.do_method3(t5,40) != "Test5::method":
43    raise "Bad return value!"
44
45