code: def test_missing_viz_attributes(self):
      G = nx.Graph()
      G.add_node(0, label="1", color="green")
      G.nodes[0]["viz"] = {"size": 54}
      G.nodes[0]["viz"]["position"] = {"x": 0, "y": 1, "z": 0}
      G.nodes[0]["viz"]["color"] = {"r": 0, "g": 0, "b": 256}
      G.nodes[0]["viz"]["shape"] = "http://random.url"
      G.nodes[0]["viz"]["thickness"] = 2
      fh = io.BytesIO()
      nx.write_gexf(G, fh, version="1.1draft")
      fh.seek(0)
      H = nx.read_gexf(fh, node_type=int)
      assert sorted(G.nodes()) == sorted(H.nodes())
      assert sorted(sorted(e) for e in G.edges()) == sorted(
          sorted(e) for e in H.edges()
      )
  
      # Test missing alpha value for version >draft1.1 - set default alpha value
      # to 1.0 instead of `None` when writing for better general compatibility
      fh = io.BytesIO()
      # G.nodes[0]["viz"]["color"] does not have an alpha value explicitly defined
      # so the default is used instead
      nx.write_gexf(G, fh, version="1.2draft")
      fh.seek(0)
      H = nx.read_gexf(fh, node_type=int)
      assert H.nodes[0]["viz"]["color"]["a"] == 1.0
  
      # Second graph for the other branch
      G = nx.Graph()
      G.add_node(0, label="1", color="green")
      G.nodes[0]["viz"] = {"size": 54}
      G.nodes[0]["viz"]["position"] = {"x": 0, "y": 1, "z": 0}
      G.nodes[0]["viz"]["color"] = {"r": 0, "g": 0, "b": 256, "a": 0.5}
      G.nodes[0]["viz"]["shape"] = "ftp://random.url"
      G.nodes[0]["viz"]["thickness"] = 2
      fh = io.BytesIO()
      nx.write_gexf(G, fh)
      fh.seek(0)
      H = nx.read_gexf(fh, node_type=int)
      assert sorted(G.nodes()) == sorted(H.nodes())
      assert sorted(sorted(e) for e in G.edges()) == sorted(
          sorted(e) for e in H.edges()
      )
  
imports: import io
  import time
  import pytest
  import networkx
label_desc: Use image node_id 20 for calling the TestGEXF obj's underlying member method code with example usage: obj.test_missing_viz_attributes() without return types