code: def test_attr_matrix():
      G = nx.Graph()
      G.add_edge(0, 1, thickness=1, weight=3)
      G.add_edge(0, 1, thickness=1, weight=3)
      G.add_edge(0, 2, thickness=2)
      G.add_edge(1, 2, thickness=3)
  
      def node_attr(u):
          return G.nodes[u].get("size", 0.5) * 3
  
      def edge_attr(u, v):
          return G[u][v].get("thickness", 0.5)
  
      M = nx.attr_matrix(G, edge_attr=edge_attr, node_attr=node_attr)
      np.testing.assert_equal(M[0], np.array([[6.0]]))
      assert M[1] == [1.5]
  
imports: import pytest
  import networkx
label_desc: Use image node_id 1 for calling a global function with example usage: test_attr_matrix() and returns: unknown, G