code: def test_from_networkx_with_same_node_and_edge_attributes():
      import networkx as nx
  
      G = nx.Graph()
      G.add_nodes_from(
          [(0, {"age": 1}), (1, {"age": 6}), (2, {"age": 5})]
      )
      G.add_edges_from([(0, 1, {"age": 2}), (1, 2, {"age": 7})])
  
      data = from_networkx(G)
      assert len(data) == 4
      assert data.age.tolist() == [1, 6, 5]
      assert data.num_nodes == 3
      assert data.edge_index.tolist() == [[0, 1, 1, 2], [1, 0, 2, 1]]
      assert data.edge_age.tolist() == [2, 2, 7, 7]
  
      data = from_networkx(
          G, group_node_attrs=all, group_edge_attrs=all
      )
      assert len(data) == 3
      assert data.x.tolist() == [[1], [6], [5]]
      assert data.edge_index.tolist() == [[0, 1, 1, 2], [1, 0, 2, 1]]
      assert data.edge_attr.tolist() == [[2], [2], [7], [7]]
  
imports: import pytest
  import scipy.sparse
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.testing import get_random_edge_index, withPackage
  from torch_geometric.utils import from_cugraph, from_dgl, from_networkit, from_networkx, from_scipy_sparse_matrix, from_trimesh, sort_edge_index, subgraph, to_cugraph, to_dgl, to_networkit, to_networkx, to_scipy_sparse_matrix, to_trimesh
label_desc: Use image node_id 15 for calling a global function with example usage: test_from_networkx_with_same_node_and_edge_attributes() without return types