code: def test_kg_triple_generator_errors(knowledge_graph):
      gen = KGTripleGenerator(knowledge_graph, 10)
  
      with pytest.raises(TypeError, match="edges: expected.*found int"):
          gen.flow(1)
  
      with pytest.raises(KeyError, match="fake"):
          gen.flow(triple_df(("fake", "W", "b")))
  
      with pytest.raises(KeyError, match="fake"):
          gen.flow(triple_df(("a", "fake", "b")))
  
      with pytest.raises(KeyError, match="fake"):
          gen.flow(triple_df(("a", "W", "fake")))
  
      with pytest.raises(
          TypeError, match="negative_samples: expected.*found str"
      ):
          gen.flow(triple_df(), negative_samples="foo")
  
      with pytest.raises(
          ValueError, match="negative_samples: expected.*found -1"
      ):
          gen.flow(triple_df(), negative_samples=-1)
  
      with pytest.raises(
          ValueError,
          match="sample_strategy: expected one of 'uniform', 'self-adversarial', found None",
      ):
          gen.flow(triple_df(), sample_strategy=None)
  
      with pytest.raises(
          ValueError,
          match="sample_strategy: expected .* found 'UNIFORM'",
      ):
          # case-sensitive
          gen.flow(triple_df(), sample_strategy="UNIFORM")
  
file_path: stellargraph/tests/mapper/test_knowledge_graph.py
imports: import pytest
  import pandas
  import numpy
  from stellargraph.mapper.knowledge_graph import KGTripleGenerator, KGTripleSequence
  from ..None import test_utils
  from ..test_utils.graphs import knowledge_graph
label_desc: Use image node_id 4 for calling a global function with example usage: test_kg_triple_generator_errors(knowledge_graph) without return types