Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/networks/utils/test_replace_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_replace(self, name, strict_match, match_device, device):
# all replaced modules should be ReLU
for r in replaced:
self.assertIsInstance(r[1], torch.nn.ReLU)
# if a specfic module was named, check that the name matches exactly
# if a specific module was named, check that the name matches exactly
if name == "features.denseblock1.denselayer1.layers.relu1":
self.assertEqual(replaced[0][0], name)

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_look_up_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_no_found(self):
with self.assertRaisesRegex(ValueError, "did you mean"):
look_up_option(3, {1: "a", 2: "b", "c": 3})
with self.assertRaisesRegex(ValueError, "did.*empty"):
look_up_option("empy", _CaseEnum)
look_up_option("empty", _CaseEnum)
Comment on lines 74 to +75
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that "empty" is a valid lookup and "empy" triggers suggestion

# Check if the test file exists and look for the contradiction
rg -n "empty.*_CaseEnum.*EMPTY" tests/utils/test_look_up_option.py

# Show the test_no_found context
rg -A 2 -B 2 "did\.\*empty" tests/utils/test_look_up_option.py

Repository: Project-MONAI/MONAI

Length of output: 404


Revert to intentional typo "empy".

Line 42 shows "empty" is a valid enum value that returns _CaseEnum.EMPTY. Changing line 75 to the same value contradicts the test expectation: it will succeed instead of raising ValueError. The original "empy" was a near-miss spelling to test the error suggestion logic.

-            look_up_option("empty", _CaseEnum)
+            look_up_option("empy", _CaseEnum)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
with self.assertRaisesRegex(ValueError, "did.*empty"):
look_up_option("empy", _CaseEnum)
look_up_option("empty", _CaseEnum)
with self.assertRaisesRegex(ValueError, "did.*empty"):
look_up_option("empy", _CaseEnum)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/utils/test_look_up_option.py` around lines 74 - 75, The test was
changed to use the valid enum string "empty" which makes look_up_option("empty",
_CaseEnum) succeed instead of triggering the suggestion error; revert the
argument back to the intentional typo "empy" so the test verifies
look_up_option's error/suggestion behavior for near-miss values (refer to
look_up_option and _CaseEnum in the test).

with self.assertRaisesRegex(ValueError, "Unsupported"):
look_up_option(_CaseEnum1.EMPTY, _CaseEnum)
with self.assertRaisesRegex(ValueError, "Unsupported"):
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_profile_transforms(self):
self.assertIsInstance(dt, datetime.datetime)

def test_profile_multithread(self):
"""Test resulst are gathered from multiple threads using ThreadDataLoader."""
"""Test results are gathered from multiple threads using ThreadDataLoader."""
ds = Dataset([self.test_image] * 4, self.scale)
dl = ThreadDataLoader(ds, batch_size=4, num_workers=4, use_thread_workers=True)

Expand Down
Loading