code: def test_negative_cycles():
      # create a small graph with a negative cycle
      graph = np.ones([5, 5])
      graph.flat[::6] = 0
      graph[1, 2] = -2
  
      def check(method, directed):
          assert_raises(
              NegativeCycleError, shortest_path, graph, method, directed
          )
  
      for method in ["FW", "J", "BF"]:
          for directed in (True, False):
              check(method, directed)
  
file_path: catboost/contrib/python/scipy/py2/scipy/sparse/csgraph/tests/test_shortest_path.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from pytest import raises
  from scipy.sparse.csgraph import shortest_path, dijkstra, johnson, bellman_ford, construct_dist_matrix, NegativeCycleError
label_desc: Use image node_id 8 for calling a global function with example usage: test_negative_cycles() without return types