code: def test_to_directed(self):
      G = self.G()
      if not G.is_directed():
          G.add_edges_from(
              [
                  ("A", "B"),
                  ("A", "C"),
                  ("B", "D"),
                  ("C", "B"),
                  ("C", "D"),
              ]
          )
  
          DG = G.to_directed()
          assert DG is not G  # directed copy or copy
  
          assert DG.is_directed()
          assert DG.name == G.name
          assert DG.adj == G.adj
          assert sorted(DG.out_edges(list("AB"))) == [
              ("A", "B"),
              ("A", "C"),
              ("B", "A"),
              ("B", "C"),
              ("B", "D"),
          ]
          DG.remove_edge("A", "B")
          assert DG.has_edge("B", "A")  # this removes B-A but not  A-B
          assert not DG.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 27 for calling the HistoricalTests obj's underlying member method code with example usage: obj.test_to_directed() without return types