code: def test_iterators(self):
      G = self.G()
      G.add_edges_from(
          [("A", "B"), ("A", "C"), ("B", "D"), ("C", "B"), ("C", "D")]
      )
      G.add_nodes_from("GJK")
      assert sorted(G.nodes()) == ["A", "B", "C", "D", "G", "J", "K"]
      assert edges_equal(
          G.edges(),
          [("A", "B"), ("A", "C"), ("B", "D"), ("C", "B"), ("C", "D")],
      )
  
      assert sorted(v for k, v in G.degree()) == [0, 0, 0, 2, 2, 3, 3]
      assert sorted(G.degree(), key=str) == [
          ("A", 2),
          ("B", 3),
          ("C", 3),
          ("D", 2),
          ("G", 0),
          ("J", 0),
          ("K", 0),
      ]
      assert sorted(G.neighbors("A")) == ["B", "C"]
      pytest.raises(nx.NetworkXError, G.neighbors, "X")
      G.clear()
      assert nx.number_of_nodes(G) == 0
      assert nx.number_of_edges(G) == 0
  
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 30 for calling the HistoricalTests obj's underlying member method code with example usage: obj.test_iterators() without return types