Skip to content

Commit 12f7dcc

Browse files
committed
Mypy fixes in tests
Signed-off-by: Chris Bridge <chrisbridge44@googlemail.com>
1 parent b7fb59c commit 12f7dcc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/transforms/test_orientation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import numpy as np
1818
import torch
1919
from parameterized import parameterized
20+
from typing import cast
2021

2122
from monai.data.meta_obj import set_track_meta
2223
from monai.data.meta_tensor import MetaTensor
@@ -311,13 +312,13 @@ def test_inverse(self, lps_convention: bool, device):
311312
img = MetaTensor(img_t, affine=affine, meta=meta)
312313
tr = Orientation("LPS")
313314
# check that image and affine have changed
314-
img = tr(img)
315+
img = cast(MetaTensor, tr(img))
315316
self.assertNotEqual(img.shape, img_t.shape)
316-
self.assertGreater((affine - img.affine).max(), 0.5)
317+
self.assertGreater(float((affine - img.affine).max()), 0.5)
317318
# check that with inverse, image affine are back to how they were
318-
img = tr.inverse(img)
319+
img = cast(MetaTensor, tr.inverse(img))
319320
self.assertEqual(img.shape, img_t.shape)
320-
self.assertLess((affine - img.affine).max(), 1e-2)
321+
self.assertLess(float((affine - img.affine).max()), 1e-2)
321322

322323

323324
if __name__ == "__main__":

0 commit comments

Comments
 (0)