MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_multiple_entities

Function test_multiple_entities

atomic-semantic/src/parsers/python.rs:675–701  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

673
674 #[test]
675 fn test_multiple_entities() {
676 let mut parser = PythonParser::new();
677 let source = r#"
678MAX_SIZE = 100
679
680def validate(data: dict) -> bool:
681 return len(data) > 0
682
683class Validator:
684 def __init__(self):
685 self.rules = []
686
687 def add_rule(self, rule):
688 self.rules.append(rule)
689
690 def validate(self, data):
691 return all(r(data) for r in self.rules)
692"#;
693 let entities = parser.extract(source, "validation.py");
694
695 let names: Vec<&str> = entities.iter().map(|e| e.name.as_str()).collect();
696 assert!(names.contains(&"MAX_SIZE"), "Should find MAX_SIZE");
697 assert!(names.contains(&"validate"), "Should find validate function");
698 assert!(names.contains(&"Validator"), "Should find Validator class");
699 assert!(names.contains(&"__init__"), "Should find __init__ method");
700 assert!(names.contains(&"add_rule"), "Should find add_rule method");
701 }
702
703 #[test]
704 fn test_language() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected