code: def test_write_with_node_attributes(self):
      # Addresses #673.
      G = nx.Graph()
      G.add_edges_from([(0, 1), (1, 2), (2, 3)])
      for i in range(4):
          G.nodes[i]["id"] = i
          G.nodes[i]["label"] = i
          G.nodes[i]["pid"] = i
          G.nodes[i]["start"] = i
          G.nodes[i]["end"] = i + 1
  
      expected = f"""<gexf xmlns="http://www.gexf.net/1.2draft" xmlns:xsi\
  ="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=\
  "http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/\
  gexf.xsd" version="1.2">
    <meta lastmodifieddate="{time.strftime('%Y-%m-%d')}">
      <creator>NetworkX {nx.__version__}</creator>
    </meta>
    <graph defaultedgetype="undirected" mode="dynamic" name="" timeformat="long">
      <nodes>
        <node id="0" label="0" pid="0" start="0" end="1" />
        <node id="1" label="1" pid="1" start="1" end="2" />
        <node id="2" label="2" pid="2" start="2" end="3" />
        <node id="3" label="3" pid="3" start="3" end="4" />
      </nodes>
      <edges>
        <edge source="0" target="1" id="0" />
        <edge source="1" target="2" id="1" />
        <edge source="2" target="3" id="2" />
      </edges>
    </graph>
  </gexf>"""
      obtained = "\n".join(nx.generate_gexf(G))
      assert expected == obtained
  
imports: import io
  import time
  import pytest
  import networkx
label_desc: Use image node_id 12 for calling the TestGEXF obj's underlying member method code with example usage: obj.test_write_with_node_attributes() without return types