code: def test_natural_entity_instance_set_validation(
      consistent_id_object_repository: ConsistentIdObjectRepository,
      scd_semantic_manifest_lookup: SemanticManifestLookup,
  ) -> None:
      """Tests instance set validation for NATURAL target entity types.
  
      These tests rely on the scd_semantic_manifest_lookup, which makes extensive use of NATURAL key types.
      """
      natural_user_instance_set = (
          consistent_id_object_repository.scd_model_data_sets[
              "primary_accounts"
          ].instance_set
      )
      primary_user_instance_set = (
          consistent_id_object_repository.scd_model_data_sets[
              "users_latest"
          ].instance_set
      )
      foreign_user_instance_set = (
          consistent_id_object_repository.scd_model_data_sets[
              "bookings_source"
          ].instance_set
      )
      unique_user_instance_set = (
          consistent_id_object_repository.scd_model_data_sets[
              "companies"
          ].instance_set
      )
      user_entity_reference = EntityReference(element_name="user")
      join_evaluator = SemanticModelJoinEvaluator(
          semantic_model_lookup=scd_semantic_manifest_lookup.semantic_model_lookup
      )
  
      # Valid cases
      natural_primary = join_evaluator.is_valid_instance_set_join(
          left_instance_set=natural_user_instance_set,
          right_instance_set=primary_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      natural_unique = join_evaluator.is_valid_instance_set_join(
          left_instance_set=natural_user_instance_set,
          right_instance_set=unique_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      foreign_natural = join_evaluator.is_valid_instance_set_join(
          left_instance_set=foreign_user_instance_set,
          right_instance_set=natural_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      primary_natural = join_evaluator.is_valid_instance_set_join(
          left_instance_set=primary_user_instance_set,
          right_instance_set=natural_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      unique_natural = join_evaluator.is_valid_instance_set_join(
          left_instance_set=unique_user_instance_set,
          right_instance_set=natural_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      # Invalid cases
      natural_foreign = join_evaluator.is_valid_instance_set_join(
          left_instance_set=natural_user_instance_set,
          right_instance_set=foreign_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
      natural_natural = join_evaluator.is_valid_instance_set_join(
          left_instance_set=natural_user_instance_set,
          right_instance_set=natural_user_instance_set,
          on_entity_reference=user_entity_reference,
      )
  
      valid_joins = {
          "natural to primary": natural_primary,
          "natural to unique": natural_unique,
          "foreign to natural": foreign_natural,
          "primary to natural": primary_natural,
          "unique to natural": unique_natural,
      }
      invalid_joins = {
          "natural to foreign": natural_foreign,
          "natural to natural": natural_natural,
      }
      assert all(valid_joins.values()) and not any(
          invalid_joins.values()
      ), (
          f"Found unexpected join validator results when validating joins involving natural key comparisons! Valid "
          f"joins marked invalid: {[k for k,v in valid_joins.items() if not v]}. Invalid joins marked valid: "
          f"{[k for k, v in invalid_joins.items() if v]}."
      )
  
file_path: metricflow/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py
imports: from __future__ import annotations
  from typing import Dict, Sequence
  from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
  from dbt_semantic_interfaces.protocols.entity import EntityType
  from dbt_semantic_interfaces.references import EntityReference, SemanticModelReference
  from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup
  from metricflow.model.semantics.semantic_model_join_evaluator import SemanticModelEntityJoin, SemanticModelEntityJoinType, SemanticModelJoinEvaluator, SemanticModelLink
  from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository
label_desc: Use image node_id 12 for calling a global function with example usage: test_natural_entity_instance_set_validation(consistent_id_object_repository, scd_semantic_manifest_lookup) without return types