code: def test_get_targets(
      ids: Union[None, torch.Tensor, Collection[Union[str, int]]],
      factory: Optional[CoreTriplesFactory],
      entity: bool,
      exp_labels: Optional[Sequence[str]],
      exp_ids: Optional[Sequence[int]],
      exp_tensor: Optional[torch.Tensor],
  ):
      """Test target normalization for target prediction."""
      device = resolve_device(device=None)
      labels_list, ids_list, ids_tensor = pykeen.predict._get_targets(
          ids=ids, triples_factory=factory, device=device, entity=entity
      )
      if exp_labels is None:
          assert labels_list is None
      else:
          assert list(labels_list) == list(exp_labels)
      if exp_ids is None:
          assert exp_ids is None
      else:
          assert list(ids_list) == list(exp_ids)
      if exp_tensor is None:
          assert ids_tensor is None
      else:
          assert (ids_tensor == exp_tensor).all()
  
imports: from typing import Any, Collection, Iterable, MutableMapping, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  import pytest
  import torch
  import unittest_templates
  import pykeen.models
  import pykeen.models.mocks
  import pykeen.predict
  import pykeen.regularizers
  import pykeen.typing
  from pykeen.constants import COLUMN_LABELS
  from pykeen.datasets.nations import Nations
  from pykeen.triples.triples_factory import AnyTriples, CoreTriplesFactory, KGInfo
  from pykeen.utils import resolve_device
  from tests import cases
label_desc: Use image node_id 12 for calling a global function with example usage: test_get_targets(ids, factory, entity, exp_labels, exp_ids, exp_tensor) without return types