MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_component

Method test_component

tests/bundle/test_config_item.py:68–78  ·  view source on GitHub ↗
(self, test_input, output_type)

Source from the content-addressed store, hash-verified

66 + ([TEST_CASE_8] if has_tv else [])
67 )
68 def test_component(self, test_input, output_type):
69 locator = ComponentLocator(excludes=["metrics"])
70 configer = ConfigComponent(id="test", config=test_input, locator=locator)
71 ret = configer.instantiate()
72 if test_input.get("_disabled_", False):
73 # test `_disabled_` works fine
74 self.assertEqual(ret, None)
75 return
76 self.assertTrue(isinstance(ret, output_type))
77 if isinstance(ret, LoadImaged):
78 self.assertEqual(ret.keys[0], "image")
79
80 @parameterized.expand([TEST_CASE_9, TEST_CASE_10, TEST_CASE_11])
81 def test_expression(self, id, test_input):

Callers

nothing calls this directly

Calls 4

instantiateMethod · 0.95
ComponentLocatorClass · 0.90
ConfigComponentClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected