docstr: Tests that a callable weight is interpreted as a weight
  function instead of an edge attribute.
code: def test_weight_function(self):
      """Tests that a callable weight is interpreted as a weight
      function instead of an edge attribute.
  
      """
      # Create a triangle in which the edge from node 0 to node 2 has
      # a large weight and the other two edges have a small weight.
      G = nx.complete_graph(3)
      G.adj[0][2]["weight"] = 10
      G.adj[0][1]["weight"] = 1
      G.adj[1][2]["weight"] = 1
  
      # The weight function will take the multiplicative inverse of
      # the weights on the edges. This way, weights that were large
      # before now become small and vice versa.
  
      def weight(u, v, d):
          return 1 / d["weight"]
  
      # The shortest path from 0 to 2 using the actual weights on the
      # edges should be [0, 1, 2].
      distance, path = nx.single_source_dijkstra(G, 0, 2)
      assert distance == 2
      assert path == [0, 1, 2]
      # However, with the above weight function, the shortest path
      # should be [0, 2], since that has a very small weight.
      distance, path = nx.single_source_dijkstra(G, 0, 2, weight=weight)
      assert distance == 1 / 10
      assert path == [0, 2]
  
imports: import pytest
  import networkx
  from networkx.utils import pairwise
label_desc: Use image node_id 15 for calling the TestWeightedPath obj's underlying member method code with example usage: obj.test_weight_function() and returns: unknown