code: def test_spanner_invalid_stretch():
      """Check whether an invalid stretch is caught."""
      with pytest.raises(ValueError):
          G = nx.empty_graph()
          nx.spanner(G, 0)
  
file_path: networkx/networkx/algorithms/tests/test_sparsifiers.py
imports: import pytest
  import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 9 for calling a global function with example usage: test_spanner_invalid_stretch() without return types