code: def test_query_parser(
      bookings_query_parser: MetricFlowQueryParser,
  ) -> None:  # noqa: D
      query_spec = bookings_query_parser.parse_and_validate_query(
          metric_names=["bookings"],
          group_by_names=["booking__is_instant", "listing", MTD],
          order_by_names=[MTD, "-bookings"],
      )
  
      assert query_spec.metric_specs == (
          MetricSpec(element_name="bookings"),
      )
      assert query_spec.dimension_specs == (
          DimensionSpec(
              element_name="is_instant",
              entity_links=(EntityReference("booking"),),
          ),
      )
      assert query_spec.time_dimension_specs == (
          TimeDimensionSpec(
              element_name=MTD,
              entity_links=(),
              time_granularity=TimeGranularity.DAY,
          ),
      )
      assert query_spec.entity_specs == (
          EntitySpec(element_name="listing", entity_links=()),
      )
      assert query_spec.order_by_specs == (
          OrderBySpec(
              instance_spec=TimeDimensionSpec(
                  element_name=MTD,
                  entity_links=(),
                  time_granularity=TimeGranularity.DAY,
              ),
              descending=False,
          ),
          OrderBySpec(
              instance_spec=MetricSpec(element_name="bookings"),
              descending=True,
          ),
      )
  
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 2 for calling a global function with example usage: test_query_parser(bookings_query_parser) without return types