code: def test_single_source_shortest_path_length(self):
      ans = dict(nx.shortest_path_length(self.cycle, 0))
      assert ans == {0: 0, 1: 1, 2: 2, 3: 3, 4: 3, 5: 2, 6: 1}
      assert ans == dict(
          nx.single_source_shortest_path_length(self.cycle, 0)
      )
      ans = dict(nx.shortest_path_length(self.grid, 1))
      assert ans[16] == 6
      # now with weights
      ans = dict(
          nx.shortest_path_length(self.cycle, 0, weight="weight")
      )
      assert ans == {0: 0, 1: 1, 2: 2, 3: 3, 4: 3, 5: 2, 6: 1}
      assert ans == dict(
          nx.single_source_dijkstra_path_length(self.cycle, 0)
      )
      ans = dict(nx.shortest_path_length(self.grid, 1, weight="weight"))
      assert ans[16] == 6
      # weights and method specified
      ans = dict(
          nx.shortest_path_length(
              self.cycle, 0, weight="weight", method="dijkstra"
          )
      )
      assert ans == {0: 0, 1: 1, 2: 2, 3: 3, 4: 3, 5: 2, 6: 1}
      assert ans == dict(
          nx.single_source_dijkstra_path_length(self.cycle, 0)
      )
      ans = dict(
          nx.shortest_path_length(
              self.cycle, 0, weight="weight", method="bellman-ford"
          )
      )
      assert ans == {0: 0, 1: 1, 2: 2, 3: 3, 4: 3, 5: 2, 6: 1}
      assert ans == dict(
          nx.single_source_bellman_ford_path_length(self.cycle, 0)
      )
  
imports: import pytest
  import networkx
label_desc: Use image node_id 7 for calling the TestGenericPath obj's underlying member method code with example usage: obj.test_single_source_shortest_path_length() without return types