code: def test_write_generate_edge_id_from_attribute(self, tmp_path):
      from xml.etree.ElementTree import parse
  
      G = nx.Graph()
      G.add_edges_from([("a", "b"), ("b", "c"), ("a", "c")])
      edge_attributes = {e: str(e) for e in G.edges}
      nx.set_edge_attributes(G, edge_attributes, "eid")
      fname = tmp_path / "test.graphml"
      # set edge_id_from_attribute e.g. "eid" for write_graphml()
      self.writer(G, fname, edge_id_from_attribute="eid")
      # set edge_id_from_attribute e.g. "eid" for generate_graphml()
      generator = nx.generate_graphml(G, edge_id_from_attribute="eid")
  
      H = nx.read_graphml(fname)
      assert nodes_equal(G.nodes(), H.nodes())
      assert edges_equal(G.edges(), H.edges())
      # NetworkX adds explicit edge "id" from file as attribute
      nx.set_edge_attributes(G, edge_attributes, "id")
      assert edges_equal(G.edges(data=True), H.edges(data=True))
  
      tree = parse(fname)
      children = list(tree.getroot())
      assert len(children) == 2
      edge_ids = [
          edge.attrib["id"]
          for edge in tree.getroot().findall(
              ".//{http://graphml.graphdrawing.org/xmlns}edge"
          )
      ]
      # verify edge id value is equal to specified attribute value
      assert sorted(edge_ids) == sorted(edge_attributes.values())
  
      # check graphml generated from generate_graphml()
      data = "".join(generator)
      J = nx.parse_graphml(data)
      assert sorted(G.nodes()) == sorted(J.nodes())
      assert sorted(G.edges()) == sorted(J.edges())
      # NetworkX adds explicit edge "id" from file as attribute
      nx.set_edge_attributes(G, edge_attributes, "id")
      assert edges_equal(G.edges(data=True), J.edges(data=True))
  
imports: import io
  import pytest
  import networkx
  from networkx.readwrite.graphml import GraphMLWriter
  from networkx.utils import edges_equal, nodes_equal
label_desc: Use image node_id 14 for calling the TestWriteGraphML obj's underlying member method code with example usage: obj.test_write_generate_edge_id_from_attribute(tmp_path) without return types