From a9a07e54a33a30d6fcff8d86ea828a665f47031f Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Mon, 13 May 2024 08:51:02 -0700 Subject: [PATCH] Test metric filter suggestions --- .../tests_metricflow_semantics/query/test_query_parser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/metricflow-semantics/tests_metricflow_semantics/query/test_query_parser.py b/metricflow-semantics/tests_metricflow_semantics/query/test_query_parser.py index d5f82d4927..7f75e78fc3 100644 --- a/metricflow-semantics/tests_metricflow_semantics/query/test_query_parser.py +++ b/metricflow-semantics/tests_metricflow_semantics/query/test_query_parser.py @@ -640,3 +640,11 @@ def query_parser_from_yaml(yaml_contents: List[YamlConfigFile]) -> MetricFlowQue return MetricFlowQueryParser( semantic_manifest_lookup=semantic_manifest_lookup, ) + + +def test_invalid_group_by_metric(bookings_query_parser: MetricFlowQueryParser) -> None: + """Tests that a query for an invalid group by metric gives an appropriate group by metric suggestion.""" + with pytest.raises(InvalidQueryException, match="Metric('bookings', group_by=['listing'])"): + bookings_query_parser.parse_and_validate_query( + metric_names=("bookings",), where_constraint_str="{{ Metric('listings', ['garbage']) }} > 1" + )