class_docstr: Class for testing triples factories.
class_docstr_tok: ["Class","for","testing","triples","factories","."]
docstr: Test detecting that the triples contain inverses, warns about them, and filters them out.
docstr_tok: ["Test","detecting","that","the","triples","contain","inverses",",","warns","about","them",",","and","filters","them","out","."]
code: def test_automatic_incomplete_inverse_detection(self):
      """Test detecting that the triples contain inverses, warns about them, and filters them out."""
      # comment(mberr): from my pov this behaviour is faulty: the triples factory is expected to say it contains
      # inverse relations, although the triples contained in it are not the same we would have when removing the
      # first triple, and passing create_inverse_triples=True.
      t = [
          ["e3", f"a.{INVERSE_SUFFIX}", "e10"],
          ["e1", "a", "e2"],
          ["e1", "a.", "e5"],
      ]
      t = np.array(t, dtype=str)
      for create_inverse_triples in (False, True):
          with patch(
              "pykeen.triples.triples_factory.logger.warning"
          ) as warning:
              factory = TriplesFactory.from_labeled_triples(
                  triples=t,
                  create_inverse_triples=create_inverse_triples,
              )
              # check for warning
              warning.assert_called()
              # check for filtered triples
              assert factory.num_triples == 2
              # check for correct inverse triples flag
              assert (
                  factory.create_inverse_triples
                  == create_inverse_triples
              )
  
imports: import itertools
  import os
  import tempfile
  import unittest
  from contextlib import nullcontext
  from pathlib import Path
  from typing import Any, Collection, Iterable, Mapping, Optional, Tuple
  from unittest.mock import patch
  import numpy
  import pytest
  import torch
  from pykeen.datasets import Hetionet, Nations, SingleTabbedDataset
  from pykeen.datasets.nations import NATIONS_TRAIN_PATH
  from pykeen.triples import CoreTriplesFactory, LCWAInstances, TriplesFactory, TriplesNumericLiteralsFactory
  from pykeen.triples.splitting import splitter_resolver
  from pykeen.triples.triples_factory import INVERSE_SUFFIX, _map_triples_elements_to_ids, get_mapped_triples
  from pykeen.triples.utils import TRIPLES_DF_COLUMNS, load_triples
  from tests.constants import RESOURCES
  from tests.utils import needs_packages
label_desc: Use image node_id 3 for calling the TestTriplesFactory obj's underlying member method code with example usage: obj.test_automatic_incomplete_inverse_detection() without return types