code: def test_user_item_serendipity(spark_diversity_data):
      train_df, reco_df, _ = spark_diversity_data
      evaluator = SparkDiversityEvaluation(
          train_df=train_df,
          reco_df=reco_df,
          col_user="UserId",
          col_item="ItemId",
          col_relevance="Relevance",
      )
      actual = evaluator.user_item_serendipity().toPandas()
      assert_frame_equal(
          pd.DataFrame(
              dict(
                  UserId=[1, 1, 2, 2, 3, 3],
                  ItemId=[3, 5, 2, 5, 1, 2],
                  user_item_serendipity=[
                      0.72783,
                      0.0,
                      0.71132,
                      0.35777,
                      0.80755,
                      0.0,
                  ],
              )
          ),
          actual,
          check_exact=False,
          atol=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 21 for calling a global function with example usage: test_user_item_serendipity(spark_diversity_data) without return types