code: def test_ensure_fallback_to_random_on_spectral_failure():
      dim = 1000
      k = 10
      assert k >= 10
      assert dim // 10 > k
      y = np.eye(dim, k=1)
      u = np.random.random((dim, dim // 10))
      graph = y + y.T + u @ u.T
      with pytest.warns(
          UserWarning, match="Spectral initialisation failed!"
      ):
          tswspectral_layout(
              u, graph, k, random_state=42, maxiter=2, method="lobpcg"
          )
  
imports: from umap.spectral import spectral_layout, tswspectral_layout
  import numpy
  import pytest
  from scipy.version import full_version
  from warnings import catch_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: test_ensure_fallback_to_random_on_spectral_failure() without return types