MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_entity_inference_parser

Function test_entity_inference_parser

src/cosql/inference/entity.rs:37–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36 #[test]
37 fn test_entity_inference_parser() {
38 let values = [
39 (
40 r#"$person1 isa person (
41 name: $name,
42 age: 18,
43 gender: "M"
44 )"#,
45 EntityInference {
46 variable: "person1".to_string(),
47 entity_type: "person".to_string(),
48 attributes: vec![
49 Attribute {
50 name: "name".to_string(),
51 value: Value::Variable("name".to_string()),
52 },
53 Attribute {
54 name: "age".to_string(),
55 value: Value::Int(18),
56 },
57 Attribute {
58 name: "gender".to_string(),
59 value: Value::String("M".to_string()),
60 },
61 ],
62 },
63 ),
64 (
65 r#"$city1 isa city (
66 name: "New York"
67 )"#,
68 EntityInference {
69 variable: "city1".to_string(),
70 entity_type: "city".to_string(),
71 attributes: vec![Attribute {
72 name: "name".to_string(),
73 value: Value::String("New York".to_string()),
74 }],
75 },
76 ),
77 ];
78
79 for (source, expected) in values {
80 let (_, parsed) = parse_entity_inference(source).unwrap();
81
82 assert_eq!(parsed, expected);
83 }
84 }
85}

Callers

nothing calls this directly

Calls 1

parse_entity_inferenceFunction · 0.85

Tested by

no test coverage detected