code: def test_spark_python_match(
      rating_true, rating_pred, spark, k, pred_start_row_i, user_id
  ):
      df_true, df_pred = rating_true, rating_pred
      df_pred = df_pred[pred_start_row_i:]
      if user_id is not None:
          df_pred = df_pred.loc[df_pred["userID"] == 3]
          df_true = df_true.loc[df_true["userID"] == 3]
  
      dfs_true = spark.createDataFrame(df_true)
      dfs_pred = spark.createDataFrame(df_pred)
  
      # Test on the original data with k = 10.
      evaluator = SparkRankingEvaluation(dfs_true, dfs_pred, k=k)
  
      assert recall_at_k(df_true, df_pred, k=k) == pytest.approx(
          evaluator.recall_at_k(), TOL
      )
      assert precision_at_k(df_true, df_pred, k=k) == pytest.approx(
          evaluator.precision_at_k(), TOL
      )
      assert ndcg_at_k(df_true, df_pred, k=k) == pytest.approx(
          evaluator.ndcg_at_k(), TOL
      )
      assert map_at_k(df_true, df_pred, k=k) == pytest.approx(
          evaluator.map_at_k(), TOL
      )
      assert map(df_true, df_pred, k=k) == pytest.approx(
          evaluator.map(), TOL
      )
  
imports: import pytest
  import numpy
  import pandas
  from pandas.util.testing import assert_frame_equal
  from recommenders.evaluation.python_evaluation import precision_at_k, recall_at_k, ndcg_at_k, map_at_k, map
label_desc: Use image node_id 14 for calling a global function with example usage: test_spark_python_match(rating_true, rating_pred, spark, k, pred_start_row_i, user_id) without return types