code: def test_dimension_in_filter_with_grain(  # noqa: D
      column_association_resolver: ColumnAssociationResolver,
  ) -> None:
      where_filter_specs = WhereSpecFactory(
          column_association_resolver=column_association_resolver,
          spec_resolution_lookup=create_spec_lookup(
              call_parameter_set=TimeDimensionCallParameterSet(
                  entity_path=(EntityReference("listing"),),
                  time_dimension_reference=TimeDimensionReference(
                      "country_latest"
                  ),
                  time_granularity=TimeGranularity.WEEK,
              ),
              resolved_spec=TimeDimensionSpec(
                  element_name="country_latest",
                  entity_links=(EntityReference("listing"),),
                  time_granularity=TimeGranularity.WEEK,
              ),
          ),
      ).create_from_where_filter_intersection(
          filter_location=EXAMPLE_FILTER_LOCATION,
          filter_intersection=create_where_filter_intersection(
              "{{ Dimension('listing__country_latest').grain('WEEK') }} = 'US'"
          ),
      )
      assert len(where_filter_specs) == 1
      where_filter_spec = where_filter_specs[0]
      assert (
          where_filter_spec.where_sql
          == "listing__country_latest__week = 'US'"
      )
      assert where_filter_spec.linkable_spec_set == LinkableSpecSet(
          dimension_specs=(),
          time_dimension_specs=(
              TimeDimensionSpec(
                  element_name="country_latest",
                  entity_links=(
                      EntityReference(element_name="listing"),
                  ),
                  time_granularity=TimeGranularity.WEEK,
              ),
          ),
          entity_specs=(),
      )
  
imports: from __future__ import annotations
  import logging
  import pytest
  from dbt_semantic_interfaces.call_parameter_sets import DimensionCallParameterSet, EntityCallParameterSet, TimeDimensionCallParameterSet
  from dbt_semantic_interfaces.implementations.filters.where_filter import PydanticWhereFilter, PydanticWhereFilterIntersection
  from dbt_semantic_interfaces.naming.keywords import METRIC_TIME_ELEMENT_NAME
  from dbt_semantic_interfaces.protocols import WhereFilterIntersection
  from dbt_semantic_interfaces.references import DimensionReference, EntityReference, MetricReference, TimeDimensionReference
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.naming.object_builder_scheme import ObjectBuilderNamingScheme
  from metricflow.query.group_by_item.filter_spec_resolution.filter_location import WhereFilterLocation
  from metricflow.query.group_by_item.filter_spec_resolution.filter_spec_lookup import CallParameterSet, FilterSpecResolution, FilterSpecResolutionLookUp, ResolvedSpecLookUpKey
  from metricflow.query.group_by_item.resolution_path import MetricFlowQueryResolutionPath
  from metricflow.query.issues.issues_base import MetricFlowQueryResolutionIssueSet
  from metricflow.specs.column_assoc import ColumnAssociationResolver
  from metricflow.specs.specs import DimensionSpec, EntitySpec, LinkableInstanceSpec, LinkableSpecSet, TimeDimensionSpec, WhereFilterSpec
  from metricflow.specs.where_filter_transform import WhereSpecFactory
  from metricflow.test.specs.conftest import EXAMPLE_FILTER_LOCATION
label_desc: Use image node_id 4 for calling a global function with example usage: test_dimension_in_filter_with_grain(column_association_resolver) without return types