code: def test_iter_entity_mappings():
      """Test iter_entity_mappings."""
      # create old, new pairs
      max_id = 33
      # simulate merging ids
      old = torch.arange(max_id)
      new = torch.randint(max_id, size=(max_id,)).sort().values
      pairs = [(old, new)]
      # only a single pair
      offsets = torch.as_tensor([0])
      # apply
      mappings = list(
          pykeen.datasets.ea.combination.iter_entity_mappings(
              *pairs, offsets=offsets
          )
      )
      assert len(mappings) == len(pairs)
      for (old, new), mapi in zip(pairs, mappings):
          # every key is contained
          assert set(mapi.keys()) == set(old.tolist())
          # value range
          assert set(mapi.values()) == set(new.tolist())
  
imports: import torch
  import unittest_templates
  import pykeen.datasets.ea.combination
  import pykeen.triples.generation
  from pykeen.triples import CoreTriplesFactory
  from pykeen.utils import triple_tensor_to_set
  from tests import cases
label_desc: Use image node_id 2 for calling a global function with example usage: test_iter_entity_mappings() without return types