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

Function TrySetInputData

Common/Core/Testing/Python/TestEmptyInput.py:231–259  ·  view source on GitHub ↗

The method SetInputData() is tried on the instantiated class. Some classes do not have an SetInputData method, if this is the case, Python will generate an AttributeError, in this case, the name of the class is stored in the global variable noUpdate and False is returned.

(b, e, d)

Source from the content-addressed store, hash-verified

229 raise
230
231def TrySetInputData(b, e, d):
232 '''
233 The method SetInputData() is tried on the instantiated class.
234
235 Some classes do not have an SetInputData method, if this is the case,
236 Python will generate an AttributeError, in this case, the name
237 of the class is stored in the global variable noUpdate and False
238 is returned.
239
240 If an error occurs on SetInputData() then the error handler
241 will be triggered and in this case False is returned.
242
243 :param: b - the class on which SetInputData() will be tried.
244 :param: e - the error handler.
245 :param: d - input data.
246 :return: True if the update was successful, False otherwise.
247 '''
248 try:
249 b.SetInputData(d)
250 if e.ErrorOccurred():
251 return False
252 else:
253 return True
254 except AttributeError:
255 # No SetInputData() method
256 noSetInput.add(b.GetClassName())
257 return False
258 except:
259 raise
260
261def TestOne(cname):
262 '''

Callers 1

TestOneFunction · 0.85

Calls 4

SetInputDataMethod · 0.45
ErrorOccurredMethod · 0.45
addMethod · 0.45
GetClassNameMethod · 0.45

Tested by

no test coverage detected