PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Python | 34 lines | 26 code | 7 blank | 1 comment | 1 complexity | 35c1ff816f088c8ecb89aa4cd0d13f41 MD5 | raw file
 1
 2from swigobject import  *
 3
 4a = A()
 5
 6
 7a1 = a_ptr(a)
 8a2 = a_ptr(a)
 9
10if a1.this != a2.this:
11  raise RuntimeError
12  
13
14lthis = long(a.this)
15# match pointer value, but deal with leading zeros on 8/16 bit systems and different C++ compilers interpretation of %p
16xstr1 = "%016X" % (lthis,)
17xstr1 = str.lstrip(xstr1, '0')
18xstr2 = pointer_str(a)
19xstr2 = str.replace(xstr2, "0x", "")
20xstr2 = str.replace(xstr2, "0X", "")
21xstr2 = str.lstrip(xstr2, '0')
22xstr2 = str.upper(xstr2)
23
24if xstr1 != xstr2:
25  print xstr1, xstr2
26  raise RuntimeError
27
28s = str(a.this)
29r = repr(a.this)
30
31v1 = v_ptr(a)
32v2 = v_ptr(a)
33if long(v1) != long(v2):
34  raise RuntimeError