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

Method testAttributes

Wrapping/Python/Testing/Python/TestDataModel.py:14–44  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

12
13class TestDataModel(vtkTesting.vtkTest):
14 def testAttributes(self):
15 from vtkmodules.vtkCommonDataModel import vtkPartitionedDataSet
16 from vtkmodules.vtkImagingCore import vtkRTAnalyticSource
17 from vtkmodules.vtkFiltersCore import vtkPointDataToCellData
18 wlt = (vtkRTAnalyticSource() >> vtkPointDataToCellData(pass_point_data=True))()
19 self.assertTrue('RTData' in wlt.point_data)
20 self.assertTrue('RTData' in wlt.cell_data)
21 rtdata = wlt.point_data['RTData']
22 self.assertTrue(issubclass(type(rtdata), numpy.ndarray))
23 self.assertTrue(rtdata.shape == (wlt.number_of_points,))
24 rtdata = wlt.cell_data['RTData']
25 self.assertTrue(issubclass(type(rtdata), numpy.ndarray))
26 self.assertTrue(rtdata.shape == (wlt.number_of_cells,))
27 wlt2 = wlt.NewInstance()
28 wlt2.DeepCopy(wlt)
29 pds = vtkPartitionedDataSet()
30 pds.append(wlt)
31 pds.append(wlt2)
32 self.assertTrue('RTData' in pds.point_data)
33
34 # test iterator + len
35 wlt.point_data["RTData2"] = rtdata * 2
36 for name in wlt.point_data:
37 self.assertTrue(name in ('RTData','RTData2'))
38
39 self.assertTrue(len(wlt.point_data) == 2)
40
41 for name in wlt.cell_data:
42 self.assertTrue(name in ('RTData',))
43
44 self.assertTrue(len(wlt.cell_data) == 1)
45
46if __name__ == "__main__":
47 vtkTesting.main([(TestDataModel, "test")])

Callers

nothing calls this directly

Calls 5

typeEnum · 0.50
NewInstanceMethod · 0.45
DeepCopyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected