MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / test_downcast_returned

Function test_downcast_returned

Wrapping/Python/tests/sitkTransformTests.py:353–376  ·  view source on GitHub ↗

Test python specific methods where returned type is downcasted to derived class.

()

Source from the content-addressed store, hash-verified

351
352
353def test_downcast_returned():
354 """Test python specific methods where returned type is downcasted to derived class."""
355 tx = sitk.AffineTransform(3)
356 itx = tx.GetInverse()
357 assert tx.__class__ == itx.__class__
358 assert tx.GetDimension() == itx.GetDimension()
359
360 tx = sitk.Euler2DTransform()
361 itx = tx.GetInverse()
362 assert tx.__class__ == itx.__class__
363 assert tx.GetDimension() == itx.GetDimension()
364
365 tx_list = [
366 sitk.AffineTransform(2),
367 sitk.Euler2DTransform(),
368 sitk.TranslationTransform(2),
369 sitk.AffineTransform(2),
370 ]
371 ctx = sitk.CompositeTransform(tx_list)
372
373 assert ctx.GetBackTransform().__class__ == sitk.AffineTransform
374
375 for i, itx in enumerate(tx_list):
376 assert ctx.GetNthTransform(i).__class__ == itx.__class__

Callers

nothing calls this directly

Calls 8

GetBackTransformMethod · 0.95
GetNthTransformMethod · 0.95
AffineTransformMethod · 0.80
GetInverseMethod · 0.80
Euler2DTransformMethod · 0.80
TranslationTransformMethod · 0.80
CompositeTransformMethod · 0.80
GetDimensionMethod · 0.45

Tested by

no test coverage detected