class_docstr: Test the pseudo-type negative sampler.
class_docstr_tok: ["Test","the","pseudo-type","negative","sampler","."]
docstr: Test the index structure.
docstr_tok: ["Test","the","index","structure","."]
code: def test_index_structure(self):
      """Test the index structure."""
      data, offsets = create_index(
          mapped_triples=self.triples_factory.mapped_triples,
          num_relations=self.triples_factory.num_relations,
      )
      triples = self.triples_factory.mapped_triples
      for r in range(self.triples_factory.num_relations):
          triples_with_r = triples[triples[:, 1] == r]
          for i, entity_pos in enumerate((0, 2)):
              index_entities = set(
                  data[
                      offsets[2 * r + i] : offsets[2 * r + i + 1]
                  ].tolist()
              )
              triple_entities = set(
                  triples_with_r[:, entity_pos].tolist()
              )
              assert index_entities == triple_entities
  
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 2 for calling the PseudoTypedNegativeSamplerTest obj's underlying member method code with example usage: obj.test_index_structure() without return types