code: def test_error_invalid_source_target(self):
      G = nx.path_graph(4)
      with pytest.raises(nx.NetworkXError):
          nx.average_neighbor_degree(G, "error")
      with pytest.raises(nx.NetworkXError):
          nx.average_neighbor_degree(G, "in", "error")
      G = G.to_directed()
      with pytest.raises(nx.NetworkXError):
          nx.average_neighbor_degree(G, "error")
      with pytest.raises(nx.NetworkXError):
          nx.average_neighbor_degree(G, "in", "error")
  
file_path: networkx/networkx/algorithms/assortativity/tests/test_neighbor_degree.py
imports: import pytest
  import networkx
label_desc: Use image node_id 6 for calling the TestAverageNeighbor obj's underlying member method code with example usage: obj.test_error_invalid_source_target() without return types