(resource_loader)
| 28 | |
| 29 | |
| 30 | def 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 | |
| 48 | def _run_tests_on_pql(queries): |
nothing calls this directly
no test coverage detected