PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-24/SWIG/Examples/python/constants/runme.py

#
Python | 27 lines | 18 code | 8 blank | 1 comment | 0 complexity | b16db693334343a1da1f909f812b9d45 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1# file: example.py
 2
 3import example 
 4
 5print "ICONST  =", example.ICONST, "(should be 42)"
 6print "FCONST  =", example.FCONST, "(should be 2.1828)"
 7print "CCONST  =", example.CCONST, "(should be 'x')"
 8print "CCONST2 =", example.CCONST2, "(this should be on a new line)"
 9print "SCONST  =", example.SCONST, "(should be 'Hello World')"
10print "SCONST2 =", example.SCONST2, "(should be '\"Hello World\"')"
11print "EXPR    =", example.EXPR,   "(should be 48.5484)"
12print "iconst  =", example.iconst, "(should be 37)"
13print "fconst  =", example.fconst, "(should be 3.14)"
14
15try:
16    print "EXTERN = ", example.EXTERN, "(Arg! This shouldn't print anything)"
17except AttributeError:
18    print "EXTERN isn't defined (good)"
19
20try:
21    print "FOO    = ", example.FOO, "(Arg! This shouldn't print anything)"
22except AttributeError:
23    print "FOO isn't defined (good)"
24
25
26
27