Test python specific methods where returned type is downcasted to derived class.
()
| 351 | |
| 352 | |
| 353 | def 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__ |
nothing calls this directly
no test coverage detected