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

Method test_files

tests/utils/test_alias.py:28–40  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26 """check that 'import monai.xx.file_name' returns a module"""
27
28 def test_files(self):
29 src_dir = os.path.dirname(TESTS_PATH)
30 monai_dir = os.path.join(src_dir, "monai")
31 py_files = glob.glob(os.path.join(monai_dir, "**", "*.py"), recursive=True)
32 for x in py_files:
33 if os.path.basename(x).startswith("_"):
34 continue
35 mod_name = x[len(src_dir) : -3] # create relative path
36 mod_name = mod_name[1:].replace(mod_name[0], ".")
37 mod, cls = mod_name.rsplit(".", 1)
38 obj, exist = optional_import(mod, name=cls)
39 if exist:
40 self.assertTrue(inspect.ismodule(obj), msg=mod_name)
41
42
43if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

optional_importFunction · 0.90

Tested by

no test coverage detected