code: def test_novelty(diversity_data):
      train_df, reco_df, _ = diversity_data
      assert novelty(
          train_df=train_df,
          reco_df=reco_df,
          col_user="UserId",
          col_item="ItemId",
      ) == pytest.approx(2.83333, TOL)
  
      # Test that novelty is zero when data includes only one item
      train_df_new = train_df.loc[train_df["ItemId"] == 3]
      reco_df_new = reco_df.loc[reco_df["ItemId"] == 3]
      assert (
          novelty(
              train_df=train_df_new,
              reco_df=reco_df_new,
              col_user="UserId",
              col_item="ItemId",
          )
          == 0
      )
  
imports: import numpy
  import pandas
  import pytest
  from unittest.mock import Mock
  from sklearn.preprocessing import minmax_scale
  from pandas.testing import assert_frame_equal
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, DEFAULT_PREDICTION_COL
  from recommenders.evaluation.python_evaluation import _check_column_dtypes, merge_rating_true_pred, merge_ranking_true_pred, rmse, mae, rsquared, exp_var, get_top_k_items, precision_at_k, recall_at_k, ndcg_at_k, map_at_k, map, auc, logloss, user_diversity, diversity, historical_item_novelty, novelty, user_item_serendipity, user_serendipity, serendipity, catalog_coverage, distributional_coverage, ColumnMismatchError, ColumnTypeMismatchError
label_desc: Use image node_id 23 for calling a global function with example usage: test_novelty(diversity_data) without return types