code: def test_order_by_granularity_conversion() -> None:
      """Test that the granularity of the primary time dimension in the order by is returned appropriately.
  
      In the case where the primary time dimension is specified in the order by without a granularity suffix, the order
      by spec returned by the parser should have a granularity appropriate for the queried metrics.
      """
      # "bookings" has a granularity of DAY, "revenue" has a granularity of MONTH
      bookings_yaml_file = YamlConfigFile(
          filepath="inline_for_test_1", contents=BOOKINGS_YAML
      )
      revenue_yaml_file = YamlConfigFile(
          filepath="inline_for_test_2", contents=REVENUE_YAML
      )
  
      query_parser = query_parser_from_yaml(
          [
              EXAMPLE_PROJECT_CONFIGURATION_YAML_CONFIG_FILE,
              bookings_yaml_file,
              revenue_yaml_file,
          ]
      )
      query_spec = query_parser.parse_and_validate_query(
          metric_names=["bookings", "revenue"],
          group_by_names=[MTD],
          order_by_names=[f"-{MTD}"],
      )
  
      # The lowest common granularity is MONTH, so we expect the PTD in the order by to have that granularity.
      assert (
          OrderBySpec(
              instance_spec=TimeDimensionSpec(
                  element_name=MTD,
                  entity_links=(),
                  time_granularity=TimeGranularity.MONTH,
              ),
              descending=True,
          ),
      ) == query_spec.order_by_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 6 for calling a global function with example usage: test_order_by_granularity_conversion() without return types