code: def test_corrupted_generator_invalid():
      with pytest.raises(
          TypeError,
          match="base_generator: expected a Generator subclass, found NoneType",
      ):
          CorruptedGenerator(None)
  
      with pytest.raises(
          TypeError,
          match="base_generator: expected a Generator that supports corruption .* found DummyGenerator",
      ):
          CorruptedGenerator(DummyGenerator(None))
  
      # incorrect type for the indices, also checking that get the indices out of the base generator
      # or from the top-level parameter are validated the same
      with pytest.raises(
          TypeError,
          match="corrupt_index_groups: expected list or tuple, found str",
      ):
          CorruptedGenerator(DummyGenerator("foo"))
  
      with pytest.raises(
          TypeError,
          match="corrupt_index_groups: expected list or tuple, found str",
      ):
          CorruptedGenerator(
              DummyGenerator(None), corrupt_index_groups="foo"
          )
  
      with pytest.raises(
          TypeError,
          match="corrupt_index_groups: expected each group to be a list or tuple, found str for group number 0",
      ):
          CorruptedGenerator(DummyGenerator(["foo"]))
  
      # incorrect contents in the indices, in various forms:
  
      with pytest.raises(
          TypeError,
          match=r"corrupt_index_groups: expected each index to be a non-negative integer, found str \('foo'\) in group number 1",
      ):
          CorruptedGenerator(DummyGenerator([[0], ["foo"]]))
  
      with pytest.raises(
          TypeError,
          match=r"corrupt_index_groups: expected each index to be a non-negative integer, found int \(-123\) in group number 2",
      ):
          CorruptedGenerator(DummyGenerator([[123], [0], [1, -123]]))
  
      with pytest.raises(
          ValueError,
          match="corrupt_index_groups: expected each group to have at least one index, found empty group number 3",
      ):
          CorruptedGenerator(DummyGenerator([[0], [1], [2], []]))
  
      with pytest.raises(
          ValueError,
          match=r"corrupt_index_groups: expected each index to appear at most once, found two occurrences of 123 \(in group numbers 0 and 0\)",
      ):
          CorruptedGenerator(DummyGenerator([[123, 123]]))
  
      with pytest.raises(
          ValueError,
          match=r"corrupt_index_groups: expected each index to appear at most once, found two occurrences of 123 \(in group numbers 0 and 1\)",
      ):
          CorruptedGenerator(DummyGenerator([[123], [1, 123]]))
  
file_path: stellargraph/tests/mapper/test_corrupted.py
imports: import pytest
  import numpy
  from stellargraph.mapper import *
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 1 for calling a global function with example usage: test_corrupted_generator_invalid() without return types