code: def test_parse_and_validate_where_constraint_dims(
      bookings_query_parser: MetricFlowQueryParser,
  ) -> None:
      """Test that the returned time constraint in the query spec is adjusted to match the granularity of the query."""
      # check constraint on invalid_dim raises InvalidQueryException
      with pytest.raises(
          InvalidQueryException,
          match="does not match any of the available",
      ):
          bookings_query_parser.parse_and_validate_query(
              metric_names=["bookings"],
              group_by_names=[MTD],
              time_constraint_start=as_datetime("2020-01-15"),
              time_constraint_end=as_datetime("2020-02-15"),
              where_constraint_str="{{ Dimension('booking__invalid_dim') }} = '1'",
          )
  
      with pytest.raises(
          InvalidQueryException, match="Error parsing where filter"
      ):
          bookings_query_parser.parse_and_validate_query(
              metric_names=["bookings"],
              group_by_names=[MTD],
              time_constraint_start=as_datetime("2020-01-15"),
              time_constraint_end=as_datetime("2020-02-15"),
              where_constraint_str="{{ Dimension('invalid_format') }} = '1'",
          )
  
      query_spec = bookings_query_parser.parse_and_validate_query(
          metric_names=["bookings"],
          group_by_names=[MTD],
          time_constraint_start=as_datetime("2020-01-15"),
          time_constraint_end=as_datetime("2020-02-15"),
          where_constraint_str="{{ Dimension('booking__is_instant') }} = '1'",
      )
      assert (
          DimensionSpec(
              element_name="is_instant",
              entity_links=(EntityReference("booking"),),
          )
          not in query_spec.dimension_specs
      )
  
imports: from __future__ import annotations
  import logging
  import textwrap
  import pytest
  from dbt_semantic_interfaces.parsing.objects import YamlConfigFile
  from dbt_semantic_interfaces.references import EntityReference
  from dbt_semantic_interfaces.test_utils import as_datetime
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.filters.time_constraint import TimeRangeConstraint
  from metricflow.query.query_exceptions import InvalidQueryException
  from metricflow.query.query_parser import MetricFlowQueryParser
  from metricflow.specs.query_param_implementations import DimensionOrEntityParameter, MetricParameter, OrderByParameter, TimeDimensionParameter
  from metricflow.specs.specs import DimensionSpec, EntitySpec, MetricSpec, OrderBySpec, TimeDimensionSpec
  from metricflow.test.fixtures.model_fixtures import query_parser_from_yaml
  from metricflow.test.model.example_project_configuration import EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE
  from metricflow.test.time.metric_time_dimension import MTD
label_desc: Use image node_id 9 for calling a global function with example usage: test_parse_and_validate_where_constraint_dims(bookings_query_parser) without return types