Skip to content

Commit c796e71

Browse files
committed
Formatting
Signed-off-by: Eric Kerfoot <[email protected]>
1 parent abaee68 commit c796e71

File tree

55 files changed

+44
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+44
-168
lines changed

tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@
88
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
11-

tests/apps/detection/networks/test_retinanet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from monai.networks import eval_mode
2121
from monai.networks.nets import resnet10, resnet18, resnet34, resnet50, resnet101, resnet152, resnet200
2222
from monai.utils import ensure_tuple, optional_import
23-
from tests.test_utils import dict_product, skip_if_quick, test_onnx_save, test_script_save
23+
from tests.test_utils import dict_product, skip_if_quick, test_onnx_save, test_script_save
2424

2525
_, has_torchvision = optional_import("torchvision")
2626

@@ -94,7 +94,6 @@
9494
TEST_CASES_TS = [[params["model"], *params["case"]] for params in dict_product(model=MODEL_LIST, case=[TEST_CASE_1])]
9595

9696

97-
9897
@unittest.skipUnless(has_torchvision, "Requires torchvision")
9998
@skip_if_quick
10099
class TestRetinaNet(unittest.TestCase):

tests/apps/detection/networks/test_retinanet_detector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from monai.apps.detection.utils.anchor_utils import AnchorGeneratorWithAnchorShape
2222
from monai.networks import eval_mode, train_mode
2323
from monai.utils import optional_import
24-
from tests.test_utils import skip_if_quick, test_script_save
24+
from tests.test_utils import skip_if_quick, test_script_save
2525

2626
_, has_torchvision = optional_import("torchvision")
2727

@@ -110,7 +110,6 @@ def forward(self, images):
110110
return {self.cls_key: [torch.randn(out_cls_shape)], self.box_reg_key: [torch.randn(out_box_reg_shape)]}
111111

112112

113-
114113
@unittest.skipUnless(has_torchvision, "Requires torchvision")
115114
@skip_if_quick
116115
class TestRetinaNetDetector(unittest.TestCase):

tests/apps/detection/utils/test_anchor_box.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from monai.apps.detection.utils.anchor_utils import AnchorGenerator, AnchorGeneratorWithAnchorShape
2020
from monai.utils import optional_import
21-
from tests.test_utils import assert_allclose, test_script_save
21+
from tests.test_utils import assert_allclose, test_script_save
2222

2323
_, has_torchvision = optional_import("torchvision")
2424

@@ -39,7 +39,6 @@
3939
]
4040

4141

42-
4342
@unittest.skipUnless(has_torchvision, "Requires torchvision")
4443
class TestAnchorGenerator(unittest.TestCase):
4544
@parameterized.expand(TEST_CASES_2D)

tests/apps/maisi/networks/test_autoencoderkl_maisi.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def test_shape(self, input_param, input_shape, expected_shape, expected_latent_s
8787
self.assertEqual(result[2].shape, expected_latent_shape)
8888

8989
@parameterized.expand(CASES)
90-
9190
def test_shape_with_convtranspose_and_checkpointing(
9291
self, input_param, input_shape, expected_shape, expected_latent_shape
9392
):
@@ -152,7 +151,6 @@ def test_shape_reconstruction(self):
152151
result = net.reconstruct(torch.randn(input_shape).to(device))
153152
self.assertEqual(result.shape, expected_shape)
154153

155-
156154
def test_shape_reconstruction_with_convtranspose_and_checkpointing(self):
157155
input_param, input_shape, expected_shape, _ = CASES[0]
158156
input_param = input_param.copy()
@@ -170,7 +168,6 @@ def test_shape_encode(self):
170168
self.assertEqual(result[0].shape, expected_latent_shape)
171169
self.assertEqual(result[1].shape, expected_latent_shape)
172170

173-
174171
def test_shape_encode_with_convtranspose_and_checkpointing(self):
175172
input_param, input_shape, _, expected_latent_shape = CASES[0]
176173
input_param = input_param.copy()
@@ -190,7 +187,6 @@ def test_shape_sampling(self):
190187
)
191188
self.assertEqual(result.shape, expected_latent_shape)
192189

193-
194190
def test_shape_sampling_convtranspose_and_checkpointing(self):
195191
input_param, _, _, expected_latent_shape = CASES[0]
196192
input_param = input_param.copy()
@@ -209,7 +205,6 @@ def test_shape_decode(self):
209205
result = net.decode(torch.randn(latent_shape).to(device))
210206
self.assertEqual(result.shape, expected_input_shape)
211207

212-
213208
def test_shape_decode_convtranspose_and_checkpointing(self):
214209
input_param, expected_input_shape, _, latent_shape = CASES[0]
215210
input_param = input_param.copy()

tests/apps/maisi/networks/test_controlnet_maisi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
]
128128

129129

130-
131130
class TestControlNet(unittest.TestCase):
132131
@parameterized.expand(TEST_CASES)
133132
@skipUnless(has_einops, "Requires einops")

tests/apps/test_auto3dseg_bundlegen.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@
2626
from monai.bundle.config_parser import ConfigParser
2727
from monai.data import create_test_image_3d
2828
from monai.utils import set_determinism
29-
from tests.test_utils import (
30-
get_testing_algo_template_path,
31-
skip_if_downloading_fails,
32-
skip_if_no_cuda,
33-
skip_if_quick,
34-
)
29+
from tests.test_utils import get_testing_algo_template_path, skip_if_downloading_fails, skip_if_no_cuda, skip_if_quick
3530

3631
num_images_perfold = max(torch.cuda.device_count(), 4)
3732
num_images_per_batch = 2

tests/apps/vista3d/test_point_based_window_inferer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from monai.networks import eval_mode
2121
from monai.networks.nets.vista3d import vista3d132
2222
from monai.utils import optional_import
23-
from tests.test_utils import skip_if_quick
23+
from tests.test_utils import skip_if_quick
2424

2525
device = "cuda" if torch.cuda.is_available() else "cpu"
2626

@@ -60,7 +60,6 @@
6060
]
6161

6262

63-
6463
@skip_if_quick
6564
class TestPointBasedWindowInferer(unittest.TestCase):
6665
@parameterized.expand(TEST_CASES)

tests/bundle/test_bundle_download.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@
2828
from monai.bundle.scripts import _examine_monai_version, _list_latest_versions, download
2929
from monai.utils import optional_import
3030
from tests.test_utils import (
31-
3231
assert_allclose,
3332
command_line_tests,
3433
skip_if_downloading_fails,
3534
skip_if_no_cuda,
3635
skip_if_quick,
37-
skip_if_windows
36+
skip_if_windows,
3837
)
3938

4039
_, has_huggingface_hub = optional_import("huggingface_hub")
@@ -398,7 +397,6 @@ def test_load_weights_with_net_override(self, bundle_name, device, net_override)
398397

399398
@parameterized.expand([TEST_CASE_9])
400399
@skip_if_quick
401-
402400
def test_load_ts_module(self, bundle_files, bundle_name, version, repo, device, model_file):
403401
with skip_if_downloading_fails():
404402
# load ts module

tests/data/meta_tensor/test_meta_tensor.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from monai.data.utils import decollate_batch, list_data_collate
3333
from monai.transforms import BorderPadd, Compose, DivisiblePadd, FromMetaTensord, ToMetaTensord
3434
from monai.utils.enums import PostFix
35-
from tests.test_utils import TEST_DEVICES, assert_allclose, dict_product, skip_if_no_cuda
35+
from tests.test_utils import TEST_DEVICES, assert_allclose, dict_product, skip_if_no_cuda
3636

3737
DTYPES = [[torch.float32], [torch.float64], [torch.float16], [torch.int64], [torch.int32], [None]]
3838

@@ -297,7 +297,6 @@ def test_dataset(self, device, dtype):
297297
self.check(im, ims[i], ids=True)
298298

299299
@parameterized.expand(DTYPES)
300-
301300
def test_dataloader(self, dtype):
302301
batch_size = 5
303302
ims = [self.get_im(dtype=dtype)[0] for _ in range(batch_size * 2)]
@@ -314,7 +313,6 @@ def test_dataloader(self, dtype):
314313
self.assertTupleEqual(tuple(batch.affine.shape), expected_affine_shape)
315314
self.assertEqual(len(batch.applied_operations), batch_size)
316315

317-
318316
def test_indexing(self):
319317
"""
320318
Check the metadata is returned in the expected format depending on whether
@@ -406,7 +404,6 @@ def test_slicing(self):
406404
self.assertEqual(x[[True, False, True]].shape, (2, 3, 4))
407405

408406
@parameterized.expand(DTYPES)
409-
410407
def test_decollate(self, dtype):
411408
batch_size = 3
412409
ims = [self.get_im(dtype=dtype)[0] for _ in range(batch_size * 2)]

0 commit comments

Comments
 (0)