From f1fc53fba4bc381ea6cefbf4487e002405dc7cdd Mon Sep 17 00:00:00 2001 From: Soumya Snigdha Kundu Date: Wed, 3 Jun 2026 16:18:45 +0100 Subject: [PATCH 1/2] tests: remove duplicate within-file test cases Several parametrized test lists contained byte-identical entries that asserted the same thing twice, contributing no extra coverage: - losses/test_unified_focal_loss.py: both TEST_CASES entries identical - inferers/test_sliding_window_inference.py: duplicate 3D small-roi case - losses/test_dice_loss.py: sigmoid case repeated - losses/test_generalized_dice_loss.py: sigmoid case repeated - transforms/utility/test_apply_transform_to_pointsd.py: duplicate entry Signed-off-by: Soumya Snigdha Kundu --- tests/inferers/test_sliding_window_inference.py | 1 - tests/losses/test_dice_loss.py | 5 ----- tests/losses/test_generalized_dice_loss.py | 5 ----- tests/losses/test_unified_focal_loss.py | 9 +-------- .../utility/test_apply_transform_to_pointsd.py | 1 - 5 files changed, 1 insertion(+), 20 deletions(-) diff --git a/tests/inferers/test_sliding_window_inference.py b/tests/inferers/test_sliding_window_inference.py index 5a624c787f..70ebb61639 100644 --- a/tests/inferers/test_sliding_window_inference.py +++ b/tests/inferers/test_sliding_window_inference.py @@ -32,7 +32,6 @@ [(1, 3, 16, 15, 7), (4, -1, 7), 3, 0.25, "constant", torch.device("cpu:0")], # 3D small roi [(2, 3, 16, 15, 7), (4, -1, 7), 3, 0.25, "constant", torch.device("cpu:0")], # 3D small roi [(3, 3, 16, 15, 7), (4, -1, 7), 3, 0.25, "constant", torch.device("cpu:0")], # 3D small roi - [(2, 3, 16, 15, 7), (4, -1, 7), 3, 0.25, "constant", torch.device("cpu:0")], # 3D small roi [(1, 3, 16, 15, 7), (4, 10, 7), 3, 0.25, "constant", torch.device("cpu:0")], # 3D small roi [(1, 3, 16, 15, 7), (20, 22, 23), 10, 0.25, "constant", torch.device("cpu:0")], # 3D large roi [(2, 3, 15, 7), (2, 6), 1000, 0.25, "constant", torch.device("cpu:0")], # 2D small roi, large batch diff --git a/tests/losses/test_dice_loss.py b/tests/losses/test_dice_loss.py index 66c038783a..d8fb5e1195 100644 --- a/tests/losses/test_dice_loss.py +++ b/tests/losses/test_dice_loss.py @@ -104,11 +104,6 @@ }, 1.534853, ], - [ # shape: (1, 1, 2, 2), (1, 1, 2, 2) - {"include_background": True, "sigmoid": True, "smooth_nr": 1e-6, "smooth_dr": 1e-6}, - {"input": torch.tensor([[[[1.0, -1.0], [-1.0, 1.0]]]]), "target": torch.tensor([[[[1.0, 0.0], [1.0, 1.0]]]])}, - 0.307576, - ], [ # shape: (1, 1, 2, 2), (1, 1, 2, 2) {"include_background": True, "sigmoid": True, "squared_pred": True}, {"input": torch.tensor([[[[1.0, -1.0], [-1.0, 1.0]]]]), "target": torch.tensor([[[[1.0, 0.0], [1.0, 1.0]]]])}, diff --git a/tests/losses/test_generalized_dice_loss.py b/tests/losses/test_generalized_dice_loss.py index 8549e87482..7d60b99932 100644 --- a/tests/losses/test_generalized_dice_loss.py +++ b/tests/losses/test_generalized_dice_loss.py @@ -112,11 +112,6 @@ }, 0.0, ], - [ # shape: (1, 1, 2, 2), (1, 1, 2, 2) - {"include_background": True, "sigmoid": True, "smooth_nr": 1e-6, "smooth_dr": 1e-6}, - {"input": torch.tensor([[[[1.0, -1.0], [-1.0, 1.0]]]]), "target": torch.tensor([[[[1.0, 0.0], [1.0, 1.0]]]])}, - 0.307576, - ], [ # shape: (1, 2, 4), (1, 1, 4) { "include_background": True, diff --git a/tests/losses/test_unified_focal_loss.py b/tests/losses/test_unified_focal_loss.py index 3b868a560e..845d359cc7 100644 --- a/tests/losses/test_unified_focal_loss.py +++ b/tests/losses/test_unified_focal_loss.py @@ -26,14 +26,7 @@ "y_true": torch.tensor([[[[1.0, 0], [0, 1.0]]], [[[1.0, 0], [0, 1.0]]]]), }, 0.0, - ], - [ # shape: (2, 1, 2, 2), (2, 1, 2, 2) - { - "y_pred": torch.tensor([[[[1.0, 0], [0, 1.0]]], [[[1.0, 0], [0, 1.0]]]]), - "y_true": torch.tensor([[[[1.0, 0], [0, 1.0]]], [[[1.0, 0], [0, 1.0]]]]), - }, - 0.0, - ], + ] ] diff --git a/tests/transforms/utility/test_apply_transform_to_pointsd.py b/tests/transforms/utility/test_apply_transform_to_pointsd.py index 978113931c..91aab663f7 100644 --- a/tests/transforms/utility/test_apply_transform_to_pointsd.py +++ b/tests/transforms/utility/test_apply_transform_to_pointsd.py @@ -57,7 +57,6 @@ POINT_3D_WORLD, ], [MetaTensor(DATA_3D, affine=AFFINE_2), POINT_3D_WORLD, None, True, True, POINT_3D_IMAGE_RAS], - [MetaTensor(DATA_3D, affine=AFFINE_2), POINT_3D_WORLD, None, True, True, POINT_3D_IMAGE_RAS], ] TEST_CASES_SEQUENCE = [ [ From 9fefa787475d20152d705989ae6a76f7b1c35cda Mon Sep 17 00:00:00 2001 From: Soumya Snigdha Kundu Date: Wed, 3 Jun 2026 16:26:38 +0100 Subject: [PATCH 2/2] tests: drop dead permanently-skipped yandex download test apps/test_download_url_yandex.py: remove test_verify, which depends on an unstable external Yandex URL and is permanently @unittest.skip-ed, so it never runs in CI. The error path remains covered by test_verify_error. Note: test_smartcachedataset::test_set_data was left skipped on purpose. Issue #5660 (the smartcache thread hanging for hours on CI) was closed as stale with no fix, so the intermittent hang risk likely remains. Signed-off-by: Soumya Snigdha Kundu --- tests/apps/test_download_url_yandex.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/apps/test_download_url_yandex.py b/tests/apps/test_download_url_yandex.py index 54d39b06ff..b29119bf07 100644 --- a/tests/apps/test_download_url_yandex.py +++ b/tests/apps/test_download_url_yandex.py @@ -18,10 +18,6 @@ from monai.apps.utils import download_url -YANDEX_MODEL_URL = ( - "https://cloud-api.yandex.net/v1/disk/public/resources/download?" - "public_key=https%3A%2F%2Fdisk.yandex.ru%2Fd%2Fxs0gzlj2_irgWA" -) YANDEX_MODEL_FLAWED_URL = ( "https://cloud-api.yandex.net/v1/disk/public/resources/download?" "public_key=https%3A%2F%2Fdisk.yandex.ru%2Fd%2Fxs0gzlj2_irgWA-url-with-error" @@ -30,11 +26,6 @@ class TestDownloadUrlYandex(unittest.TestCase): - @unittest.skip("data source unstable") - def test_verify(self): - with tempfile.TemporaryDirectory() as tempdir: - download_url(url=YANDEX_MODEL_URL, filepath=os.path.join(tempdir, "model.pt")) - def test_verify_error(self): with tempfile.TemporaryDirectory() as tempdir: with self.assertRaises(HTTPError):