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

Method test2

Common/ExecutionModel/Testing/Python/TestEnsemble.py:41–87  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

39 self.assertEqual(r.GetOutputDataObject(0).GetNumberOfCells(), TestEnsemble.npolys[i])
40
41 def test2(self):
42 global nExecutions
43
44 r = self.createSource()
45
46 nExecutions = 0
47 def addToCounter(obj, event):
48 global nExecutions
49 nExecutions += 1
50 r.AddObserver('StartEvent', addToCounter)
51
52 shrink = vtkShrinkPolyData()
53 shrink.SetInputConnection(r.GetOutputPort())
54 shrink.UpdateInformation()
55
56 self.assertTrue(shrink.GetOutputInformation(0).Has(vtkEnsembleSource.META_DATA()))
57
58 metaData = shrink.GetOutputInformation(0).Has(vtkEnsembleSource.META_DATA())
59
60 shrink.Update()
61
62 oInfo = shrink.GetOutputInformation(0)
63 oInfo.Set(vtkEnsembleSource.UPDATE_MEMBER(), 2)
64 shrink.Update()
65
66 output = shrink.GetOutputDataObject(0)
67
68 self.assertEqual(output.GetNumberOfCells(), TestEnsemble.npolys[2])
69
70 shrink.Update()
71
72 oInfo = shrink.GetOutputInformation(0)
73 oInfo.Set(vtkEnsembleSource.UPDATE_MEMBER(), 1)
74 shrink.Update()
75
76 self.assertEqual(output.GetNumberOfCells(), TestEnsemble.npolys[1])
77
78 shrink2 = vtkShrinkPolyData()
79 shrink2.SetInputConnection(r.GetOutputPort())
80
81 shrink2.Update()
82
83 output2 = shrink2.GetOutputDataObject(0)
84
85 self.assertEqual(output.GetNumberOfCells(), TestEnsemble.npolys[1])
86
87 self.assertEqual(nExecutions, 3)
88
89if __name__ == "__main__":
90 Testing.main([(TestEnsemble, 'test')])

Callers

nothing calls this directly

Calls 11

createSourceMethod · 0.95
AddObserverMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
UpdateInformationMethod · 0.45
HasMethod · 0.45
GetOutputInformationMethod · 0.45
UpdateMethod · 0.45
SetMethod · 0.45
GetOutputDataObjectMethod · 0.45
GetNumberOfCellsMethod · 0.45

Tested by

no test coverage detected