MCPcopy Create free account
hub / github.com/cisco/mindmeld / test_flatten_query_tree

Function test_flatten_query_tree

tests/test_resource_loader.py:30–45  ·  view source on GitHub ↗
(resource_loader)

Source from the content-addressed store, hash-verified

28
29
30def test_flatten_query_tree(resource_loader):
31 qmap = resource_loader.get_labeled_queries()
32 count = 0
33 for intent_dict in qmap.values():
34 for query_ids in intent_dict.values():
35 count += len(query_ids)
36 flattened = resource_loader.flatten_query_tree(qmap)
37 # verify that all queries in tree are flattened
38 assert count == len(flattened)
39
40 # verify that query trees built from different query_caches will raise an error
41 hash_id = resource_loader.query_factory.text_preparation_pipeline.get_hashid()
42 qmap["banking"]["transfer_money"].cache = QueryCache(app_path=resource_loader.app_path,
43 schema_version_hash=hash_id)
44 with pytest.raises(ValueError):
45 flattened = resource_loader.flatten_query_tree(qmap)
46
47
48def _run_tests_on_pql(queries):

Callers

nothing calls this directly

Calls 4

QueryCacheClass · 0.90
get_labeled_queriesMethod · 0.80
flatten_query_treeMethod · 0.80
get_hashidMethod · 0.45

Tested by

no test coverage detected