Test the named class. Some classes will generate a TypeError or an AttributeError, in this case, the name of the class is stored in the global variable abstractClasses or noConcreteImplementation with False being returned. Return values: 0: If not any of the SetInput() tes
(cname)
| 259 | raise |
| 260 | |
| 261 | def TestOne(cname): |
| 262 | ''' |
| 263 | Test the named class. |
| 264 | |
| 265 | Some classes will generate a TypeError or an AttributeError, |
| 266 | in this case, the name of the class is stored in the global variable |
| 267 | abstractClasses or noConcreteImplementation with False being returned. |
| 268 | |
| 269 | Return values: |
| 270 | 0: If not any of the SetInput() tests and the corresponding |
| 271 | Update() are both true. |
| 272 | 1: If at least one of SetInput() tests and the corresponding |
| 273 | Update() are both true. |
| 274 | 2: No observer could be added. |
| 275 | 3: If it is an abstract class. |
| 276 | 4: No concrete implementation. |
| 277 | 5: Class does not exist. |
| 278 | |
| 279 | :param: cname - the name of the class to be tested. |
| 280 | :return: One of the above return values. |
| 281 | ''' |
| 282 | try: |
| 283 | b = getattr(vtkmodules.all, cname)() |
| 284 | e = ErrorObserver() |
| 285 | isAlgorithm = False |
| 286 | # A record of whether b.SetInput() worked or not. |
| 287 | # The indexing corresponds to using |
| 288 | # emptyPD, emptyID, emptySG, emptyUG, emptyRG in SetInput() |
| 289 | iStatus = [False, False, False, False, False] |
| 290 | # A record of whether b.Update() worked or not. |
| 291 | # The indexing corresponds to: |
| 292 | # [emptyPD, emptyID, emptySG, emptyUG, emptyRG] |
| 293 | uStatus = [False, False, False, False, False] |
| 294 | try: |
| 295 | b.AddObserver('ErrorEvent', e) |
| 296 | except AttributeError: |
| 297 | noObserver.add(cname) |
| 298 | return 2 |
| 299 | except: |
| 300 | raise |
| 301 | if b.IsA("vtkAlgorithm"): |
| 302 | u = TryUpdate(b, e) |
| 303 | if u: |
| 304 | isAlgorithm = True |
| 305 | |
| 306 | if TrySetInputData(b, e, emptyPD): |
| 307 | iStatus[0] = True |
| 308 | u = TryUpdate(b, e) |
| 309 | if u: |
| 310 | uStatus[0] = True |
| 311 | |
| 312 | if TrySetInputData(b, e, emptyID): |
| 313 | iStatus[1] = True |
| 314 | u = TryUpdate(b, e) |
| 315 | if u: |
| 316 | uStatus[1] = True |
| 317 | |
| 318 | if TrySetInputData(b, e, emptySG): |
no test coverage detected