| 583 | |
| 584 | #[test] |
| 585 | fn test_extract_imports() { |
| 586 | let mut parser = PythonParser::new(); |
| 587 | let source = r#" |
| 588 | import os |
| 589 | from pathlib import Path |
| 590 | from typing import Optional, List |
| 591 | "#; |
| 592 | let entities = parser.extract(source, "main.py"); |
| 593 | let imports: Vec<_> = entities |
| 594 | .iter() |
| 595 | .filter(|e| e.kind == EntityKind::Import) |
| 596 | .collect(); |
| 597 | assert!( |
| 598 | imports.len() >= 2, |
| 599 | "Should find imports, got: {:?}", |
| 600 | imports.iter().map(|e| &e.name).collect::<Vec<_>>() |
| 601 | ); |
| 602 | } |
| 603 | |
| 604 | #[test] |
| 605 | fn test_private_function_not_exported() { |