code: def test_kmp_table():
      word = ("a", "b", "c", "d", "a", "b", "d")
      expected_table = [-1, 0, 0, 0, 0, 1, 2]
      assert expected_table == kmp_table(word)
  
      word = (
          "P",
          "A",
          "R",
          "T",
          "I",
          "C",
          "I",
          "P",
          "A",
          "T",
          "E",
          " ",
          "I",
          "N",
          " ",
          "P",
          "A",
          "R",
          "A",
          "C",
          "H",
          "U",
          "T",
          "E",
      )
      expected_table = [
          -1,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          2,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          2,
          3,
          0,
          0,
          0,
          0,
          0,
      ]
      assert expected_table == kmp_table(word)
  
      x = X(0)
      y = Y(0)
      z = Z(0)
      h = H(0)
      word = (x, y, y, x, z)
      expected_table = [-1, 0, 0, 0, 1]
      assert expected_table == kmp_table(word)
  
      word = (x, x, y, h, z)
      expected_table = [-1, 0, 1, 0, 0]
      assert expected_table == kmp_table(word)
  
file_path: sympy/sympy/physics/quantum/tests/test_circuitutils.py
imports: from sympy.core.mul import Mul
  from sympy.core.numbers import Integer
  from sympy.core.symbol import Symbol
  from sympy.utilities import numbered_symbols
  from sympy.physics.quantum.gate import X, Y, Z, H, CNOT, CGate
  from sympy.physics.quantum.identitysearch import bfs_identity_search
  from sympy.physics.quantum.circuitutils import kmp_table, find_subcircuit, replace_subcircuit, convert_to_symbolic_indices, convert_to_real_indices, random_reduce, random_insert, flatten_ids
  from sympy.testing.pytest import slow
label_desc: Use image node_id 2 for calling a global function with example usage: test_kmp_table() without return types