Skip to content

Commit ae97ff7

Browse files
author
its-serah
committed
Separate unrelated test logic in test methods
- Remove _MiniReader functionality tests from test_reader_not_installed_exception - Focus test_reader_not_installed_exception only on raise_on_missing_reader flag - Move _MiniReader tests to test_my_reader where they belong logically - Each test method now has a single, clear responsibility This addresses CodeRabbit feedback about separating unrelated test concerns. Signed-off-by: Sarah <[email protected]>
1 parent 16b0ba6 commit ae97ff7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/transforms/test_load_image.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,18 @@ def test_my_reader(self):
437437
self.assertEqual(out.meta["name"], "my test")
438438
out = LoadImage(image_only=True, reader=_MiniReader, is_compatible=False)("test")
439439
self.assertEqual(out.meta["name"], "my test")
440-
441-
def test_reader_not_installed_exception(self):
442-
"""test if an exception is raised when a specified reader is not installed"""
443-
with self.assertRaises(OptionalImportError):
444-
LoadImage(image_only=True, reader="NonExistentReader", raise_on_missing_reader=True)
440+
# Test runtime reader specification
445441
for item in (_MiniReader, _MiniReader(is_compatible=False)):
446442
out = LoadImage(image_only=True, reader=item)("test")
447443
self.assertEqual(out.meta["name"], "my test")
448444
out = LoadImage(image_only=True)("test", reader=_MiniReader(is_compatible=False))
449445
self.assertEqual(out.meta["name"], "my test")
450446

447+
def test_reader_not_installed_exception(self):
448+
"""test if an exception is raised when a specified reader is not installed"""
449+
with self.assertRaises(OptionalImportError):
450+
LoadImage(image_only=True, reader="NonExistentReader", raise_on_missing_reader=True)
451+
451452
def test_raise_on_missing_reader_flag(self):
452453
"""test raise_on_missing_reader flag behavior"""
453454
# Test with flag enabled - should raise exception for unknown reader name

0 commit comments

Comments
 (0)