diff --git a/tests/fl/monai_algo/test_fl_monai_algo.py b/tests/fl/monai_algo/test_fl_monai_algo.py index 2c1a8488cc0..d6db49d95dc 100644 --- a/tests/fl/monai_algo/test_fl_monai_algo.py +++ b/tests/fl/monai_algo/test_fl_monai_algo.py @@ -53,18 +53,6 @@ "config_filters_filename": None, } ] -TEST_TRAIN_3 = [ - { - "bundle_root": _data_dir, - "train_workflow": ConfigWorkflow( - config_file=os.path.join(_data_dir, "config_fl_train.json"), - workflow_type="train", - logging_file=_logging_file, - ), - "config_evaluate_filename": None, - "config_filters_filename": os.path.join(_data_dir, "config_fl_filters.json"), - } -] TEST_TRAIN_4 = [ { @@ -182,7 +170,7 @@ @SkipIfNoModule("ignite") @SkipIfNoModule("mlflow") class TestFLMonaiAlgo(unittest.TestCase): - @parameterized.expand([TEST_TRAIN_1, TEST_TRAIN_2, TEST_TRAIN_3, TEST_TRAIN_4]) + @parameterized.expand([TEST_TRAIN_1, TEST_TRAIN_2, TEST_TRAIN_4]) def test_train(self, input_params): # initialize algo algo = MonaiAlgo(**input_params) diff --git a/tests/inferers/test_patch_inferer.py b/tests/inferers/test_patch_inferer.py index 02c6a378374..44dcbc46570 100644 --- a/tests/inferers/test_patch_inferer.py +++ b/tests/inferers/test_patch_inferer.py @@ -231,17 +231,6 @@ TEST_CASE_ERROR_8 = [torch.zeros(2, 2), dict(splitter=None), ValueError] # invalid inputs: split patches MetaTensor without location metadata TEST_CASE_ERROR_9 = [MetaTensor(torch.zeros(2, 2)), dict(splitter=None), ValueError] -# merged_shape is not provided for the merger -TEST_CASE_ERROR_10 = [ - [ - (TENSOR_4x4[..., :2, :2], (0, 0)), - (TENSOR_4x4[..., :2, 2:], (0, 2)), - (TENSOR_4x4[..., 2:, :2], (2, 0)), - (TENSOR_4x4[..., 2:, 2:], (2, 2)), - ], - dict(splitter=SlidingWindowSplitter(patch_size=(2, 2))), - ValueError, -] class PatchInfererTests(unittest.TestCase): diff --git a/tests/transforms/spatial/test_grid_patch.py b/tests/transforms/spatial/test_grid_patch.py index b6fb9168a56..920e8514b48 100644 --- a/tests/transforms/spatial/test_grid_patch.py +++ b/tests/transforms/spatial/test_grid_patch.py @@ -31,7 +31,6 @@ TEST_CASE_1 = [{"patch_size": (2, 2), "num_patches": 3}, A, [A11, A12, A21]] TEST_CASE_2 = [{"patch_size": (2, 2), "num_patches": 5}, A, [A11, A12, A21, A22, np.zeros((3, 2, 2))]] TEST_CASE_3 = [{"patch_size": (2, 2), "offset": (0, 0)}, A, [A11, A12, A21, A22]] -TEST_CASE_4 = [{"patch_size": (2, 2), "offset": (0, 0)}, A, [A11, A12, A21, A22]] TEST_CASE_5 = [{"patch_size": (2, 2), "offset": (2, 2)}, A, [A22]] TEST_CASE_6 = [{"patch_size": (2, 2), "offset": (0, 2)}, A, [A12, A22]] TEST_CASE_7 = [{"patch_size": (2, 2), "offset": (2, 0)}, A, [A21, A22]] @@ -81,7 +80,6 @@ TEST_CASES.append([p, *TEST_CASE_1]) TEST_CASES.append([p, *TEST_CASE_2]) TEST_CASES.append([p, *TEST_CASE_3]) - TEST_CASES.append([p, *TEST_CASE_4]) TEST_CASES.append([p, *TEST_CASE_5]) TEST_CASES.append([p, *TEST_CASE_6]) TEST_CASES.append([p, *TEST_CASE_7]) diff --git a/tests/transforms/spatial/test_grid_patchd.py b/tests/transforms/spatial/test_grid_patchd.py index 81e1da8b5b9..2f51f2765b6 100644 --- a/tests/transforms/spatial/test_grid_patchd.py +++ b/tests/transforms/spatial/test_grid_patchd.py @@ -30,7 +30,6 @@ TEST_CASE_1 = [{"patch_size": (2, 2), "num_patches": 3}, {"image": A}, [A11, A12, A21]] TEST_CASE_2 = [{"patch_size": (2, 2), "num_patches": 5}, {"image": A}, [A11, A12, A21, A22, np.zeros((3, 2, 2))]] TEST_CASE_3 = [{"patch_size": (2, 2), "offset": (0, 0)}, {"image": A}, [A11, A12, A21, A22]] -TEST_CASE_4 = [{"patch_size": (2, 2), "offset": (0, 0)}, {"image": A}, [A11, A12, A21, A22]] TEST_CASE_5 = [{"patch_size": (2, 2), "offset": (2, 2)}, {"image": A}, [A22]] TEST_CASE_6 = [{"patch_size": (2, 2), "offset": (0, 2)}, {"image": A}, [A12, A22]] TEST_CASE_7 = [{"patch_size": (2, 2), "offset": (2, 0)}, {"image": A}, [A21, A22]] @@ -61,7 +60,6 @@ TEST_SINGLE.append([p, *TEST_CASE_1]) TEST_SINGLE.append([p, *TEST_CASE_2]) TEST_SINGLE.append([p, *TEST_CASE_3]) - TEST_SINGLE.append([p, *TEST_CASE_4]) TEST_SINGLE.append([p, *TEST_CASE_5]) TEST_SINGLE.append([p, *TEST_CASE_6]) TEST_SINGLE.append([p, *TEST_CASE_7]) diff --git a/tests/transforms/spatial/test_rand_grid_patch.py b/tests/transforms/spatial/test_rand_grid_patch.py index 884c7269f10..2d9ca455362 100644 --- a/tests/transforms/spatial/test_rand_grid_patch.py +++ b/tests/transforms/spatial/test_rand_grid_patch.py @@ -35,7 +35,6 @@ A, [A11, A12, A21, A22, np.zeros((3, 2, 2))], ] -TEST_CASE_3 = [{"patch_size": (2, 2), "min_offset": 0, "max_offset": 0}, A, [A11, A12, A21, A22]] TEST_CASE_4 = [{"patch_size": (2, 2)}, A, [A11, A12, A21, A22]] TEST_CASE_5 = [{"patch_size": (2, 2), "min_offset": 2, "max_offset": 2}, A, [A22]] TEST_CASE_6 = [{"patch_size": (2, 2), "min_offset": (0, 2), "max_offset": (0, 2)}, A, [A12, A22]] @@ -91,7 +90,6 @@ TEST_SINGLE.append([p, *TEST_CASE_0]) TEST_SINGLE.append([p, *TEST_CASE_1]) TEST_SINGLE.append([p, *TEST_CASE_2]) - TEST_SINGLE.append([p, *TEST_CASE_3]) TEST_SINGLE.append([p, *TEST_CASE_4]) TEST_SINGLE.append([p, *TEST_CASE_5]) TEST_SINGLE.append([p, *TEST_CASE_6]) diff --git a/tests/transforms/spatial/test_rand_grid_patchd.py b/tests/transforms/spatial/test_rand_grid_patchd.py index 6b0f9d6eb36..59bdba4a4f7 100644 --- a/tests/transforms/spatial/test_rand_grid_patchd.py +++ b/tests/transforms/spatial/test_rand_grid_patchd.py @@ -34,7 +34,6 @@ {"image": A}, [A11, A12, A21, A22, np.zeros((3, 2, 2))], ] -TEST_CASE_3 = [{"patch_size": (2, 2), "min_offset": 0, "max_offset": 0}, {"image": A}, [A11, A12, A21, A22]] TEST_CASE_4 = [{"patch_size": (2, 2)}, {"image": A}, [A11, A12, A21, A22]] TEST_CASE_5 = [{"patch_size": (2, 2), "min_offset": 2, "max_offset": 2}, {"image": A}, [A22]] TEST_CASE_6 = [{"patch_size": (2, 2), "min_offset": (0, 2), "max_offset": (0, 2)}, {"image": A}, [A12, A22]] @@ -71,7 +70,6 @@ TEST_SINGLE.append([p, *TEST_CASE_0]) TEST_SINGLE.append([p, *TEST_CASE_1]) TEST_SINGLE.append([p, *TEST_CASE_2]) - TEST_SINGLE.append([p, *TEST_CASE_3]) TEST_SINGLE.append([p, *TEST_CASE_4]) TEST_SINGLE.append([p, *TEST_CASE_5]) TEST_SINGLE.append([p, *TEST_CASE_6]) diff --git a/tests/transforms/test_load_image.py b/tests/transforms/test_load_image.py index 4a470a624c9..9d04b2253d5 100644 --- a/tests/transforms/test_load_image.py +++ b/tests/transforms/test_load_image.py @@ -54,8 +54,6 @@ def get_data(self, _obj): TEST_CASE_1 = [{}, ["test_image.nii.gz"], (128, 128, 128)] -TEST_CASE_2 = [{}, ["test_image.nii.gz"], (128, 128, 128)] - TEST_CASE_3 = [{}, ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], (3, 128, 128, 128)] TEST_CASE_3_1 = [ # .mgz format @@ -64,8 +62,6 @@ def get_data(self, _obj): (3, 128, 128, 128), ] -TEST_CASE_4 = [{}, ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], (3, 128, 128, 128)] - TEST_CASE_4_1 = [ # additional parameter {"mmap": False}, ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], @@ -92,8 +88,6 @@ def get_data(self, _obj): TEST_CASE_6 = [{"reader": ITKReader() if has_itk else "itkreader"}, ["test_image.nii.gz"], (128, 128, 128)] -TEST_CASE_7 = [{"reader": ITKReader() if has_itk else "itkreader"}, ["test_image.nii.gz"], (128, 128, 128)] - TEST_CASE_8 = [ {"reader": ITKReader() if has_itk else "itkreader"}, ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], @@ -106,12 +100,6 @@ def get_data(self, _obj): (384, 128, 128), ] -TEST_CASE_9 = [ - {"reader": ITKReader() if has_itk else "itkreader"}, - ["test_image.nii.gz", "test_image2.nii.gz", "test_image3.nii.gz"], - (3, 128, 128, 128), -] - TEST_CASE_10 = [ {"reader": ITKReader(pixel_type=itk_uc) if has_itk else "itkreader"}, "tests/testing_data/CT_DICOM", @@ -205,9 +193,7 @@ def tearDownClass(cls): shutil.rmtree(cls.tmpdir) super().tearDownClass() - @parameterized.expand( - [TEST_CASE_1, TEST_CASE_2, TEST_CASE_3, TEST_CASE_3_1, TEST_CASE_4, TEST_CASE_4_1, TEST_CASE_5] - ) + @parameterized.expand([TEST_CASE_1, TEST_CASE_3, TEST_CASE_3_1, TEST_CASE_4_1, TEST_CASE_5]) def test_nibabel_reader(self, input_param, filenames, expected_shape): test_image = np.random.rand(128, 128, 128) with tempfile.TemporaryDirectory() as tempdir: @@ -249,7 +235,7 @@ def test_nibabel_reader_gpu(self, input_param, filenames, expected_shape): result_cpu = LoadImage(image_only=True, **input_param_cpu)(filenames) assert_allclose(result_cpu, result.cpu(), atol=1e-6) - @parameterized.expand([TEST_CASE_6, TEST_CASE_7, TEST_CASE_8, TEST_CASE_8_1, TEST_CASE_9]) + @parameterized.expand([TEST_CASE_6, TEST_CASE_8, TEST_CASE_8_1]) def test_itk_reader(self, input_param, filenames, expected_shape): test_image = torch.randint(0, 256, (128, 128, 128), dtype=torch.uint8).numpy() print("Test image value range:", test_image.min(), test_image.max())