code: def test_spark_exp_var(spark_data):
      df_true, df_pred = spark_data
  
      evaluator = SparkRatingEvaluation(
          df_true, df_true, col_prediction="rating"
      )
      assert evaluator.exp_var() == pytest.approx(1.0, TOL)
  
      evaluator = SparkRatingEvaluation(df_true, df_pred)
      assert evaluator.exp_var() == pytest.approx(-6.4466, 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 8 for calling a global function with example usage: test_spark_exp_var(spark_data) without return types