code: def test_sparse_matrix_scipy(format, sps_fmt_checker):
      ratings = ml_test.ratings
      mat, uidx, iidx = sparse_ratings(ratings, scipy=format)
  
      assert sps.issparse(mat)
      assert sps_fmt_checker(mat)
      assert len(uidx) == ratings.user.nunique()
      assert len(iidx) == ratings.item.nunique()
  
      # user indicators should correspond to user item counts
      ucounts = ratings.groupby("user").item.count()
      ucounts = ucounts.loc[uidx].cumsum()
      if sps.isspmatrix_coo(mat):
          mat = mat.tocsr()
      assert all(mat.indptr[1:] == ucounts.values)
  
file_path: lkpy/tests/test_matrix.py
imports: import scipy.sparse
  import pandas
  from lenskit.data import sparse_ratings
  from lenskit.util.test import ml_test
  from pytest import mark
label_desc: Use image node_id 3 for calling a global function with example usage: test_sparse_matrix_scipy(format, sps_fmt_checker) without return types