code: def _verify_entity_corruption(
      instance: NegativeSampler, positive_batch: torch.LongTensor
  ):
      """Verify that at most one entity is corrupted."""
      negative_batch = instance.corrupt_batch(
          positive_batch=positive_batch
      )
      positive_batch = positive_batch.unsqueeze(dim=1).repeat(
          1, instance.num_negs_per_pos, 1
      )
      # same relation
      numpy.testing.assert_array_equal(
          negative_batch[..., 1], positive_batch[..., 1]
      )
      # only corruption of a single entity (note: we do not check for exactly 2, since we do not filter).
      numpy.testing.assert_array_less(
          1, (negative_batch == positive_batch).sum(dim=-1)
      )
  
imports: import numpy.testing
  import torch
  import unittest_templates
  from pykeen.sampling import BasicNegativeSampler, BernoulliNegativeSampler, NegativeSampler, PseudoTypedNegativeSampler
  from pykeen.sampling.pseudo_type import create_index
  from tests.test_sampling import cases
label_desc: Use image node_id 1 for calling a global function with example usage: _verify_entity_corruption(instance, positive_batch) without return types