code: def test_degree_k4(self):
      G = nx.complete_graph(4)
      answer = {0: 3, 1: 3, 2: 3, 3: 3}
      nd = nx.average_neighbor_degree(G)
      assert nd == answer
  
      D = G.to_directed()
      nd = nx.average_neighbor_degree(D)
      assert nd == answer
  
      D = G.to_directed()
      nd = nx.average_neighbor_degree(D)
      assert nd == answer
  
      D = G.to_directed()
      nd = nx.average_neighbor_degree(D, source="in", target="in")
      assert nd == answer
  
file_path: networkx/networkx/algorithms/assortativity/tests/test_neighbor_degree.py
imports: import pytest
  import networkx
label_desc: Use image node_id 3 for calling the TestAverageNeighbor obj's underlying member method code with example usage: obj.test_degree_k4() without return types