MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / test_path_to_module

Function test_path_to_module

flow-rs/src/loader/python/mod.rs:258–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256
257 #[test]
258 fn test_path_to_module() {
259 let mut module_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
260 module_path.pop();
261 module_path.push("flow-python/examples");
262 let mut path = PathBuf::from(&module_path);
263 path.push("logical_test/source.py");
264 let ret = path_to_module(&module_path, &path);
265 assert!(ret.is_ok());
266 assert_eq!(ret.unwrap(), "logical_test.source".to_owned());
267
268 path.pop();
269 let ret = path_to_module(&module_path, &path);
270 assert!(ret.is_ok());
271 assert_eq!(ret.unwrap(), "logical_test".to_owned());
272
273 path.pop();
274 let ret = path_to_module(&module_path, &path);
275 assert!(ret.is_err());
276
277 path.pop();
278 let ret = path_to_module(&module_path, &path);
279 assert!(ret.is_err());
280 }
281}

Callers

nothing calls this directly

Calls 3

path_to_moduleFunction · 0.85
popMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected