class_docstr: Unit tests for the nested tuple encoding and decoding functions.
class_docstr_tok: ["Unit","tests","for","the","nested","tuple","encoding","and","decoding","functions","."]
code: def test_canonical_form(self):
      T = nx.Graph()
      T.add_edges_from([(0, 1), (0, 2), (0, 3)])
      T.add_edges_from([(1, 4), (1, 5)])
      T.add_edges_from([(3, 6), (3, 7)])
      root = 0
      actual = nx.to_nested_tuple(T, root, canonical_form=True)
      expected = ((), ((), ()), ((), ()))
      assert actual == expected
  
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 4 for calling the TestNestedTuple obj's underlying member method code with example usage: obj.test_canonical_form() without return types