code: def test_edges_nbunch(self):
      # Test G.edges(nbunch) with various forms of nbunch
      G = self.G()
      G.add_edges_from(
          [("A", "B"), ("A", "C"), ("B", "D"), ("C", "B"), ("C", "D")]
      )
      # node not in nbunch should be quietly ignored
      pytest.raises(nx.NetworkXError, G.edges, 6)
      assert list(G.edges("Z")) == []  # iterable non-node
      # nbunch can be an empty list
      assert list(G.edges([])) == []
      if G.is_directed():
          elist = [("A", "B"), ("A", "C"), ("B", "D")]
      else:
          elist = [("A", "B"), ("A", "C"), ("B", "C"), ("B", "D")]
      # nbunch can be a list
      assert edges_equal(list(G.edges(["A", "B"])), elist)
      # nbunch can be a set
      assert edges_equal(G.edges({"A", "B"}), elist)
      # nbunch can be a graph
      G1 = self.G()
      G1.add_nodes_from("AB")
      assert edges_equal(G.edges(G1), elist)
      # nbunch can be a dict with nodes as keys
      ndict = {"A": "thing1", "B": "thing2"}
      assert edges_equal(G.edges(ndict), elist)
      # nbunch can be a single node
      assert edges_equal(list(G.edges("A")), [("A", "B"), ("A", "C")])
      assert nodes_equal(sorted(G), ["A", "B", "C", "D"])
  
      # nbunch can be nothing (whole graph)
      assert edges_equal(
          list(G.edges()),
          [("A", "B"), ("A", "C"), ("B", "D"), ("C", "B"), ("C", "D")],
      )
  
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 19 for calling the HistoricalTests obj's underlying member method code with example usage: obj.test_edges_nbunch() without return types