class_docstr: Unit tests for the Prüfer sequence encoding and decoding
  functions.
class_docstr_tok: ["Unit","tests","for","the","Pr\u00fcfer","sequence","encoding","and","decoding","functions","."]
docstr: Tests that the encoding and decoding functions are inverses.
docstr_tok: ["Tests","that","the","encoding","and","decoding","functions","are","inverses","."]
code: def test_inverse(self):
      """Tests that the encoding and decoding functions are inverses."""
      for T in nx.nonisomorphic_trees(4):
          T2 = nx.from_prufer_sequence(nx.to_prufer_sequence(T))
          assert nodes_equal(list(T), list(T2))
          assert edges_equal(list(T.edges()), list(T2.edges()))
  
      for seq in product(range(4), repeat=2):
          seq2 = nx.to_prufer_sequence(nx.from_prufer_sequence(seq))
          assert list(seq) == seq2
  
file_path: networkx/networkx/algorithms/tree/tests/test_coding.py
imports: from itertools import product
  import pytest
  import networkx
  from networkx.utils import edges_equal, nodes_equal
label_desc: Use image node_id 8 for calling the TestPruferSequence obj's underlying member method code with example usage: obj.test_inverse() without return types