code: def test_intersection_attributes():
      g = nx.Graph()
      g.add_node(0, x=4)
      g.add_node(1, x=5)
      g.add_edge(0, 1, size=5)
      g.graph["name"] = "g"
  
      h = g.copy()
      h.graph["name"] = "h"
      h.graph["attr"] = "attr"
      h.nodes[0]["x"] = 7
      gh = nx.intersection(g, h)
  
      assert set(gh.nodes()) == set(g.nodes())
      assert set(gh.nodes()) == set(h.nodes())
      assert sorted(gh.edges()) == sorted(g.edges())
  
imports: import os
  import pytest
  import networkx
  from networkx.classes.tests import dispatch_interface
  from networkx.utils import edges_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_intersection_attributes() without return types