MCPcopy Create free account
hub / github.com/Kitware/VTK / testObjId

Method testObjId

Web/Core/Testing/Python/TestObjectIdMap.py:7–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5
6class TestObjectId(Testing.vtkTest):
7 def testObjId(self):
8 map = vtkObjectIdMap()
9 # Just make sure if we call it twice with None, the results match
10 objId1 = map.GetGlobalId(None)
11 objId1b = map.GetGlobalId(None)
12 print('Object ids for None: objId1 => ',objId1,', objId1b => ',objId1b)
13 self.assertTrue(objId1 == objId1b)
14
15 object2 = vtkObject()
16 addr2 = object2.__this__
17 addr2 = addr2[1:addr2.find('_', 1)]
18 addr2 = int(addr2, 16)
19
20 object3 = vtkObject()
21 addr3 = object3.__this__
22 addr3 = addr3[1:addr3.find('_', 1)]
23 addr3 = int(addr3, 16)
24
25 # insert the bigger address first
26 if (addr2 < addr3):
27 object2, object3 = object3, object2
28
29 objId2 = map.GetGlobalId(object2)
30 objId2b = map.GetGlobalId(object2)
31 print('Object ids for object2: objId2 => ',objId2,', objId2b => ',objId2b)
32 self.assertTrue(objId2 == objId2b)
33
34 objId3 = map.GetGlobalId(object3)
35 objId3b = map.GetGlobalId(object3)
36 print('Object ids for object3: objId3 => ',objId3,', objId3b => ',objId3b)
37 self.assertTrue(objId3 == objId3b)
38
39if __name__ == "__main__":
40 Testing.main([(TestObjectId, 'test')])

Callers

nothing calls this directly

Calls 4

GetGlobalIdMethod · 0.80
printFunction · 0.50
vtkObjectClass · 0.50
findMethod · 0.45

Tested by

no test coverage detected