| 560 | |
| 561 | #[test] |
| 562 | fn test_extract_imports() { |
| 563 | let mut parser = PythonParser::new(); |
| 564 | let source = r#" |
| 565 | import os |
| 566 | from pathlib import Path |
| 567 | from typing import Optional, List |
| 568 | "#; |
| 569 | let entities = parser.extract(source, "main.py"); |
| 570 | let imports: Vec<_> = entities |
| 571 | .iter() |
| 572 | .filter(|e| e.kind == EntityKind::Import) |
| 573 | .collect(); |
| 574 | assert!( |
| 575 | imports.len() >= 2, |
| 576 | "Should find imports, got: {:?}", |
| 577 | imports.iter().map(|e| &e.name).collect::<Vec<_>>() |
| 578 | ); |
| 579 | } |
| 580 | |
| 581 | #[test] |
| 582 | fn test_private_function_not_exported() { |