code: def test_to_undirected(self):
      G = self.G()
      if G.is_directed():
          G.add_edges_from(
              [
                  ("A", "B"),
                  ("A", "C"),
                  ("B", "D"),
                  ("C", "B"),
                  ("C", "D"),
              ]
          )
          UG = G.to_undirected()  # to_undirected
          assert UG is not G
          assert not UG.is_directed()
          assert G.is_directed()
          assert UG.name == G.name
          assert UG.adj != G.adj
          assert sorted(UG.edges(list("AB"))) == [
              ("A", "B"),
              ("A", "C"),
              ("B", "C"),
              ("B", "D"),
          ]
          assert sorted(UG.edges(["A", "B"])) == [
              ("A", "B"),
              ("A", "C"),
              ("B", "C"),
              ("B", "D"),
          ]
          UG.remove_edge("A", "B")
          assert not UG.has_edge("B", "A")
          assert not UG.has_edge("A", "B")
  
imports: import pytest
  import networkx
  from networkx import convert_node_labels_to_integers
  from networkx.utils import edges_equal, nodes_equal
label_desc: Use image node_id 28 for calling the HistoricalTests obj's underlying member method code with example usage: obj.test_to_undirected() without return types