MCPcopy Index your code
hub / github.com/Project-MONAI/MONAI / test_default

Method test_default

tests/utils/test_optional_import.py:26–30  ·  view source on GitHub ↗
(self, import_module)

Source from the content-addressed store, hash-verified

24
25 @parameterized.expand(["not_a_module", "torch.randint"])
26 def test_default(self, import_module):
27 my_module, flag = optional_import(import_module)
28 self.assertFalse(flag)
29 with self.assertRaises(OptionalImportError):
30 my_module.test
31
32 def test_import_valid(self):
33 my_module, flag = optional_import("torch")

Callers

nothing calls this directly

Calls 1

optional_importFunction · 0.90

Tested by

no test coverage detected