Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8185 - Refactor test #8231

Open
wants to merge 94 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
075ec11
Eliminates code repetition
garciadias Nov 20, 2024
e8d3e19
Replace relative import with absolute
garciadias Nov 20, 2024
d4b01e6
Directly tests export_ckpt function instead of using command_line_tests
garciadias Nov 21, 2024
bfc68a4
Style fix
garciadias Nov 21, 2024
10eb2af
Merge branch 'dev' into 8185-tests-refactor
garciadias Nov 21, 2024
55fcd22
Revert "Style fix"
garciadias Nov 23, 2024
ba16743
Revert "Replace relative import with absolute"
garciadias Nov 23, 2024
1667eb7
Revert "Directly tests export_ckpt function instead of using command_…
garciadias Nov 23, 2024
702e740
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 24, 2024
9a2c2f4
moves tests to their corresponding folder
garciadias Nov 28, 2024
f2cf158
replace relative imports with absolute import
garciadias Nov 28, 2024
b3fd8e9
Change locating integrations
garciadias Nov 28, 2024
114fc72
Corrects the download path for integration tests
garciadias Nov 28, 2024
626e050
Move array/* and dictionary/* files to parent directory
garciadias Dec 2, 2024
4c6b59c
Move single files on their parent folders
garciadias Dec 2, 2024
050e71b
Merge remote-tracking branch 'upstream/dev' into dev
garciadias Dec 2, 2024
7d68938
Merge branch 'dev' into 8185-tests-refactor
garciadias Dec 2, 2024
3508211
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 2, 2024
2d55074
Recovers deleted file
garciadias Dec 3, 2024
6e9c66e
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Dec 3, 2024
fa5c75c
Merge remote-tracking branch 'upstream/dev' into dev
garciadias Dec 4, 2024
dda65c4
Merge branch 'dev' into 8185-tests-refactor
garciadias Dec 4, 2024
bf82225
Start fixing path issues after moving files
garciadias Dec 6, 2024
56c2a48
Keep fixing data paths
garciadias Dec 9, 2024
98d3ab2
rerouting paths
garciadias Dec 11, 2024
6d1af88
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Dec 11, 2024
a0d2395
Solve many more issues
garciadias Dec 11, 2024
9977e98
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Dec 11, 2024
8831dc0
reorder imports
garciadias Dec 11, 2024
58c461c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 11, 2024
bb85f53
Fix path issues
garciadias Dec 11, 2024
865dc22
Move utils inside utils to avoid coflict
garciadias Dec 12, 2024
cf1025a
Keep cleaning tests but reverting utils.utils change
Dec 16, 2024
d2e7a2e
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Jan 8, 2025
5632fdf
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Jan 20, 2025
4af739c
rename utils to distinguish from utils folder
garciadias Jan 20, 2025
19b2fdf
Restore deleted testing_data files
garciadias Jan 23, 2025
7a34f01
Corrects testing_data paths on tests
garciadias Jan 23, 2025
0730b56
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Jan 23, 2025
069b07c
autofix
garciadias Jan 23, 2025
67c0521
correct reference to util
garciadias Jan 23, 2025
a4a0baa
Fixes more of the util problems
garciadias Jan 23, 2025
34627e8
revert changes unrelated to test restructuring
garciadias Jan 23, 2025
08cd2ac
Correct utils in the reverted files
garciadias Jan 23, 2025
d348aa6
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Jan 25, 2025
dc7b39b
Restore deleted testing_data files
garciadias Jan 23, 2025
e789ddd
Corrects testing_data paths on tests
garciadias Jan 23, 2025
1638587
Fix bundle download error from ngc source (#8307)
KumoLiu Jan 21, 2025
74d0481
autofix
garciadias Jan 23, 2025
931f01d
correct reference to util
garciadias Jan 23, 2025
1091266
Fixes more of the util problems
garciadias Jan 23, 2025
58e9e3b
revert changes unrelated to test restructuring
garciadias Jan 23, 2025
f8d9bcf
Correct utils in the reverted files
garciadias Jan 23, 2025
cfd497b
Fix deprecated usage in zarr (#8313)
KumoLiu Jan 24, 2025
f31c919
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Jan 27, 2025
6c51fce
DCO Remediation Commit for R. Garcia-Dias <[email protected]>
garciadias Jan 27, 2025
b4d6db4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 27, 2025
1d3fb15
DCO Remediation Commit for R. Garcia-Dias <[email protected]>
garciadias Jan 27, 2025
88ec64f
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Jan 27, 2025
ad04781
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Jan 28, 2025
d37a568
No issues encounter on linting, so I will just triger the CI again.
garciadias Jan 28, 2025
fe0ce22
Fixing with correct version of isort (6.0.0)
garciadias Jan 28, 2025
204cb51
change back imports in array.py and update isort version constraint i…
garciadias Jan 28, 2025
5067d68
Update torch version constraint in requirements.txt to restrict to <2…
garciadias Jan 29, 2025
63954be
Reverce Isort downgrade and fix pycln to v1.5.0
garciadias Jan 29, 2025
8660e43
Update .pre-commit-config.yaml
garciadias Jan 29, 2025
a18be5f
solves the isort 6 conflicting with black problem and adds the new bl…
garciadias Jan 29, 2025
a627a61
Renames tests.util.py to tests.test_utils
garciadias Feb 3, 2025
f327614
Merge remote-tracking branch 'upstream/dev' into 8185-tests-refactor
garciadias Feb 3, 2025
be54650
autofix
garciadias Feb 3, 2025
d4a818f
autofix with black upgrade.
garciadias Feb 3, 2025
8d4a657
Corrects _dist.py discovery on runtests.sh
garciadias Feb 3, 2025
30a1e63
Fix -u test discovery in runner.py using pathlib for improved path ha…
garciadias Feb 4, 2025
8ecdd16
corrects the excluded tests printing
garciadias Feb 4, 2025
1e281a6
Autofix
garciadias Feb 4, 2025
fbbcafc
Fixes testing_data paths
garciadias Feb 4, 2025
e7e48ae
Fixes more wrong paths
garciadias Feb 4, 2025
63b73d9
Remove debugging breakpoint from runner.py
garciadias Feb 5, 2025
70966c0
move test_image_rw.py to tests/data/
garciadias Feb 5, 2025
48b4ef2
Fix test paths in test_bundle_ckpt_export.py
garciadias Feb 5, 2025
4b07a2d
autofix
garciadias Feb 5, 2025
c80df45
Fixes tests.integration.test_integration_bundle_run TestBundleRun.tes…
garciadias Feb 6, 2025
9f3474e
fixes paths on tests.networks.test_bundle_onnx_export
garciadias Feb 6, 2025
2481afb
fix text discovery
garciadias Feb 7, 2025
21132b5
Remove nested folders
garciadias Feb 7, 2025
35e3036
Add init files to every tests subfolder
garciadias Feb 7, 2025
7247555
Adds license to all __init__.py files
garciadias Feb 7, 2025
beef622
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 7, 2025
9bb9cec
autofix
garciadias Feb 7, 2025
71793c8
Merge remote-tracking branch 'origin/8185-tests-refactor' into 8185-t…
garciadias Feb 7, 2025
1a6b9b3
fixes paths on moved files
garciadias Feb 7, 2025
95d1d15
removes __init__.py from data folders
garciadias Feb 8, 2025
59f75bf
removes __init__.py from data folders
garciadias Feb 8, 2025
d43a30a
removes __init__.py from data folders
garciadias Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion monai/transforms/io/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""
A collection of "vanilla" transforms for IO functions.
"""

from __future__ import annotations

import inspect
Expand Down
4 changes: 2 additions & 2 deletions runtests.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest logic didn't update here.
Now:

[2025-02-03T15:33:49.029Z] With file pattern: '^(?!test_integration).*(?<!_dist)$'
[2025-02-03T15:33:49.029Z] monai test runner: excluding tests.test_call_dist
[2025-02-03T15:33:49.029Z] monai test runner: excluding tests.test_timedcall_dist
[2025-02-03T15:33:49.029Z] ['tests.test_rand_torchio', 'tests.test_query_memory', 'tests.test_utils', 'tests.test_rand_torchiod', 'tests.test_masked_autoencoder_vit', 'tests.test_torchiod', 'tests.test_torchio', 'tests.test_print_info', 'tests.test_set_visible_devices', 'tests.test_auto3dseg']
[2025-02-03T15:33:49.029Z] time to discover tests: 1.4007233679294586s, total cases: 66.

Previous:

time to discover tests: 10.140145242214203s, total cases: 15864.

BTW, didn't check other tests.

also cc @ericspod

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am looking into the runtests.py file and trying to solve this. This regular expression seems to be filtering the tests, which is ok, but it is probably looking only on the root folder of the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@ericspod ericspod Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@garciadias This is one of those places that we need to do recursive glob searching like the other areas we discussed. The whole block mentioned here can be done as something like:

    with PerfContext() as pc:
        # the files are searched from `tests/` folder, starting with `test_`
        cur_dir = os.path.dirname(__file__)
        files = glob.glob(os.path.join(cur_dir, "**", "test_*.py"), recursive=True)
        files = [f for f in files if re.match(args.pattern, f)]
        cases = [os.path.relpath(f, cur_dir).replace(os.sep, ".").replace(".py", "") for f in files]
        print(cases)

        tests = unittest.TestLoader().loadTestsFromNames(cases)

I think what you have in the current version if equivalent, I'm double checking myself in case we've missed something but then any other issues could be in runtests.sh as you mentioned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that it has been updated. Please ignore.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was the problem. I think I have now fixed it. I can't find any coverage report for the most recent commits. Is that something I need to trigger?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was the problem. I think I have now fixed it. I can't find any coverage report for the most recent commits. Is that something I need to trigger?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codecov used to post a link for things in PRs, but the page is always https://app.codecov.io/gh/Project-MONAI/MONAI I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link for this PR however isn't so helpful at the moment: https://app.codecov.io/gh/Project-MONAI/MONAI/pull/8231

Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ if [ $doDistTests = true ]
then
echo "${separator}${blue}run distributed unit test cases${noColor}"
torch_validate
for i in tests/test_*_dist.py
for i in $(find ./tests/ -name "*_dist.py")
do
echo "$i"
${cmdPrefix}${cmd} "$i"
Expand All @@ -740,7 +740,7 @@ if [ $doNetTests = true ]
then
set +e # disable exit on failure so that diagnostics can be given on failure
echo "${separator}${blue}integration${noColor}"
for i in tests/*integration_*.py
garciadias marked this conversation as resolved.
Show resolved Hide resolved
for i in tests/integration/*.py
do
echo "$i"
${cmdPrefix}${cmd} "$i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from monai.networks import eval_mode
from monai.networks.nets import resnet10, resnet18, resnet34, resnet50, resnet101, resnet152, resnet200
from monai.utils import ensure_tuple, optional_import
from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_onnx_save, test_script_save
from tests.test_utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_onnx_save, test_script_save

_, has_torchvision = optional_import("torchvision")

Expand Down Expand Up @@ -101,7 +101,6 @@
@unittest.skipUnless(has_torchvision, "Requires torchvision")
@skip_if_quick
class TestRetinaNet(unittest.TestCase):

@parameterized.expand(TEST_CASES)
def test_retina_shape(self, model, input_param, input_shape):
backbone = model(**input_param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from monai.apps.detection.utils.anchor_utils import AnchorGeneratorWithAnchorShape
from monai.networks import eval_mode, train_mode
from monai.utils import optional_import
from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_script_save
from tests.test_utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_script_save

_, has_torchvision = optional_import("torchvision")

Expand Down Expand Up @@ -93,7 +93,6 @@


class NaiveNetwork(torch.nn.Module):

def __init__(self, spatial_dims, num_classes, **kwargs):
super().__init__()
self.spatial_dims = spatial_dims
Expand All @@ -115,7 +114,6 @@ def forward(self, images):
@unittest.skipUnless(has_torchvision, "Requires torchvision")
@skip_if_quick
class TestRetinaNetDetector(unittest.TestCase):

@parameterized.expand(TEST_CASES)
def test_retina_detector_resnet_backbone_shape(self, input_param, input_shape):
returned_layers = [1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)
from monai.data.meta_tensor import MetaTensor
from monai.transforms import CastToTyped, Invertd
from tests.utils import TEST_NDARRAYS, assert_allclose
from tests.test_utils import TEST_NDARRAYS, assert_allclose

TESTS_3D = []
boxes = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 2, 3, 3], [0, 1, 1, 2, 3, 4]]
Expand Down Expand Up @@ -79,7 +79,6 @@


class TestBoxTransform(unittest.TestCase):

@parameterized.expand(TESTS_2D_mask)
def test_value_2d_mask(self, mask, expected_box_label):
box_label = convert_mask_to_box(mask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from monai.apps.detection.utils.anchor_utils import AnchorGenerator, AnchorGeneratorWithAnchorShape
from monai.utils import optional_import
from tests.utils import SkipIfBeforePyTorchVersion, assert_allclose, test_script_save
from tests.test_utils import SkipIfBeforePyTorchVersion, assert_allclose, test_script_save

_, has_torchvision = optional_import("torchvision")

Expand All @@ -42,7 +42,6 @@
@SkipIfBeforePyTorchVersion((1, 11))
@unittest.skipUnless(has_torchvision, "Requires torchvision")
class TestAnchorGenerator(unittest.TestCase):

@parameterized.expand(TEST_CASES_2D)
def test_anchor_2d(self, input_param, image_shape, feature_maps_shapes):
torch_anchor_utils, _ = optional_import("torchvision.models.detection.anchor_utils")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from monai.apps.detection.utils.ATSS_matcher import ATSSMatcher
from monai.data.box_utils import box_iou
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

TEST_CASES = [
[
Expand All @@ -33,7 +33,6 @@


class TestATSS(unittest.TestCase):

@parameterized.expand(TEST_CASES)
def test_atss(self, input_param, boxes, anchors, num_anchors_per_level, num_anchors_per_loc, expected_matches):
matcher = ATSSMatcher(**input_param, debug=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@

from monai.apps.detection.utils.box_coder import BoxCoder
from monai.transforms import CastToType
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose


class TestBoxTransform(unittest.TestCase):

def test_value(self):
box_coder = BoxCoder(weights=[1, 1, 1, 1, 1, 1])
test_dtype = [torch.float32, torch.float16]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from parameterized import parameterized

from monai.apps.detection.utils.box_selector import BoxSelector
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

device = "cuda" if torch.cuda.is_available() else "cpu"
num_anchors = 7
Expand Down Expand Up @@ -56,7 +56,6 @@


class TestBoxSelector(unittest.TestCase):

@parameterized.expand(TEST_CASE)
def test_box_selector(self, input_param, boxes, logits, image_shape, expected_results):
box_selector = BoxSelector(**input_param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from monai.apps.detection.utils.detector_utils import preprocess_images
from monai.utils import ensure_tuple
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

TEST_CASE_1 = [ # 3D, batch 3, 2 input channel
{
Expand Down Expand Up @@ -79,7 +79,6 @@


class TestDetectorUtils(unittest.TestCase):

@parameterized.expand(TEST_CASES)
def test_detector_utils(self, input_param, input_shape, expected_shape):
size_divisible = 32 * ensure_tuple(input_param["conv1_t_stride"])[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from parameterized import parameterized

from monai.apps.detection.utils.hard_negative_sampler import HardNegativeSampler
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

TEST_CASE = [
[[], [], [], [torch.tensor([]), torch.tensor([])], [torch.tensor([]), torch.tensor([])]],
Expand All @@ -37,7 +37,6 @@


class TestSampleSlices(unittest.TestCase):

@parameterized.expand(TEST_CASE)
def test_shape(self, target_label0, target_label1, concat_fg_probs, expected_result_pos, expected_result_neg):
compute_dtypes = [torch.float16, torch.float32]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from monai.apps.generation.maisi.networks.autoencoderkl_maisi import AutoencoderKlMaisi
from monai.networks import eval_mode
from monai.utils import optional_import
from tests.utils import SkipIfBeforePyTorchVersion
from tests.test_utils import SkipIfBeforePyTorchVersion

tqdm, has_tqdm = optional_import("tqdm", name="tqdm")
_, has_einops = optional_import("einops")
Expand Down Expand Up @@ -77,7 +77,6 @@


class TestAutoencoderKlMaisi(unittest.TestCase):

@parameterized.expand(CASES)
def test_shape(self, input_param, input_shape, expected_shape, expected_latent_shape):
net = AutoencoderKlMaisi(**input_param).to(device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from monai.apps.generation.maisi.networks.controlnet_maisi import ControlNetMaisi
from monai.networks import eval_mode
from monai.utils import optional_import
from tests.utils import SkipIfBeforePyTorchVersion
from tests.test_utils import SkipIfBeforePyTorchVersion

_, has_einops = optional_import("einops")

Expand Down Expand Up @@ -129,7 +129,6 @@

@SkipIfBeforePyTorchVersion((2, 0))
class TestControlNet(unittest.TestCase):

@parameterized.expand(TEST_CASES)
@skipUnless(has_einops, "Requires einops")
def test_shape_unconditioned_models(self, input_param, expected_num_down_blocks_residuals, expected_shape):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from parameterized import parameterized

from monai.apps.pathology.handlers.utils import from_engine_hovernet
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

TEST_CASE_0 = [
[{"A": {"C": 1, "D": 2}, "B": {"C": 2, "D": 2}}, {"A": {"C": 3, "D": 2}, "B": {"C": 4, "D": 2}}],
Expand All @@ -28,7 +28,6 @@


class TestFromEngineHovernet(unittest.TestCase):

@parameterized.expand(CASES)
def test_results(self, input, expected):
output = from_engine_hovernet(keys=["A", "B"], nested_key="C")(input)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from monai.apps.pathology.engines import PrepareBatchHoVerNet
from monai.engines import SupervisedEvaluator
from monai.utils.enums import HoVerNetBranch
from tests.utils import assert_allclose
from tests.test_utils import assert_allclose

TEST_CASE_0 = [
{"extra_keys": ["extra_label1", "extra_label2"]},
Expand All @@ -35,7 +35,6 @@ def forward(self, x: torch.Tensor):


class TestPrepareBatchHoVerNet(unittest.TestCase):

@parameterized.expand([TEST_CASE_0])
def test_content(self, input_args, expected_value):
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from monai.data import MetaTensor
from monai.inferers import sliding_window_inference
from monai.utils import optional_import
from tests.test_sliding_window_inference import TEST_CASES
from tests.inferers.test_sliding_window_inference import TEST_CASES

_, has_tqdm = optional_import("tqdm")

Expand All @@ -36,7 +36,6 @@


class TestSlidingWindowHoVerNetInference(unittest.TestCase):

@parameterized.expand(TEST_CASES_PADDING)
def test_sliding_window_with_padding(
self, key, image_shape, roi_shape, sw_batch_size, overlap, mode, device, extra_input_padding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from monai.apps.pathology.transforms.post.array import GenerateDistanceMap
from monai.transforms.intensity.array import GaussianSmooth
from tests.utils import TEST_NDARRAYS
from tests.test_utils import TEST_NDARRAYS

EXCEPTION_TESTS = []
TESTS = []
Expand All @@ -36,7 +36,6 @@


class TestGenerateDistanceMap(unittest.TestCase):

@parameterized.expand(EXCEPTION_TESTS)
def test_value(self, arguments, mask, probmap, exception_type):
with self.assertRaises(exception_type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from monai.apps.pathology.transforms.post.dictionary import GenerateDistanceMapd
from monai.transforms.intensity.array import GaussianSmooth
from tests.utils import TEST_NDARRAYS
from tests.test_utils import TEST_NDARRAYS

EXCEPTION_TESTS = []
TESTS = []
Expand Down Expand Up @@ -55,7 +55,6 @@


class TestGenerateDistanceMapd(unittest.TestCase):

@parameterized.expand(EXCEPTION_TESTS)
def test_value(self, arguments, mask, border_map, exception_type):
with self.assertRaises(exception_type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from parameterized import parameterized

from monai.apps.pathology.transforms.post.array import GenerateInstanceBorder
from tests.utils import TEST_NDARRAYS
from tests.test_utils import TEST_NDARRAYS

EXCEPTION_TESTS = []
TESTS = []
Expand All @@ -34,7 +34,6 @@


class TestGenerateInstanceBorder(unittest.TestCase):

@parameterized.expand(EXCEPTION_TESTS)
def test_value(self, arguments, mask, hover_map, exception_type):
with self.assertRaises(exception_type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from parameterized import parameterized

from monai.apps.pathology.transforms.post.dictionary import GenerateInstanceBorderd
from tests.utils import TEST_NDARRAYS
from tests.test_utils import TEST_NDARRAYS

EXCEPTION_TESTS = []
TESTS = []
Expand All @@ -44,7 +44,6 @@


class TestGenerateInstanceBorderd(unittest.TestCase):

@parameterized.expand(EXCEPTION_TESTS)
def test_value(self, arguments, mask, hover_map, exception_type):
with self.assertRaises(exception_type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from monai.apps.pathology.transforms.post.array import GenerateInstanceCentroid
from monai.transforms import BoundingRect
from monai.utils import min_version, optional_import
from tests.utils import TEST_NDARRAYS, assert_allclose
from tests.test_utils import TEST_NDARRAYS, assert_allclose

_, has_skimage = optional_import("skimage", "0.19.3", min_version)

Expand All @@ -41,7 +41,6 @@

@unittest.skipUnless(has_skimage, "Requires scikit-image library.")
class TestGenerateInstanceCentroid(unittest.TestCase):

@parameterized.expand(TEST_CASE)
def test_shape(self, in_type, test_data, offset, expected):
inst_bbox = get_bbox(test_data[None])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from monai.apps.pathology.transforms.post.dictionary import GenerateInstanceCentroidd
from monai.transforms import BoundingRect
from monai.utils import min_version, optional_import
from tests.utils import TEST_NDARRAYS, assert_allclose
from tests.test_utils import TEST_NDARRAYS, assert_allclose

_, has_skimage = optional_import("skimage", "0.19.3", min_version)

Expand All @@ -41,7 +41,6 @@

@unittest.skipUnless(has_skimage, "Requires scikit-image library.")
class TestGenerateInstanceCentroidd(unittest.TestCase):

@parameterized.expand(TEST_CASE)
def test_shape(self, in_type, test_data, offset, expected):
inst_bbox = get_bbox(test_data[None])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from monai.apps.pathology.transforms.post.array import GenerateInstanceContour
from monai.transforms import BoundingRect
from monai.utils import min_version, optional_import
from tests.utils import TEST_NDARRAYS, assert_allclose
from tests.test_utils import TEST_NDARRAYS, assert_allclose

_, has_skimage = optional_import("skimage", "0.19.3", min_version)

Expand All @@ -46,7 +46,6 @@

@unittest.skipUnless(has_skimage, "Requires scikit-image library.")
class TestGenerateInstanceContour(unittest.TestCase):

@parameterized.expand(TEST_CASE)
def test_shape(self, in_type, test_data, min_num_points, offset, expected):
inst_bbox = get_bbox(test_data[None])
Expand Down
Loading
Loading