code: def test_load_spark_df(
      size,
      num_samples,
      num_movies,
      movie_example,
      title_example,
      genres_example,
      year_example,
      tmp,
      spark,
  ):
      """Test MovieLens dataset load into pySpark.DataFrame"""
  
      # Test if correct data are loaded
      header = ["1", "2", "3"]
      schema = StructType(
          [
              StructField("u", IntegerType()),
              StructField("m", IntegerType()),
          ]
      )
      with pytest.warns(Warning):
          df = load_spark_df(
              spark,
              size=size,
              local_cache_path=tmp,
              header=header,
              schema=schema,
          )
          assert df.count() == num_samples
          # Test if schema is used when both schema and header are provided
          assert len(df.columns) == len(schema)
          # Test if raw-zip file, rating file, and item file are cached
          assert len(os.listdir(tmp)) == 3
  
      # Test title, genres, and released year load
      header = ["a", "b", "c", "d", "e"]
      with pytest.warns(Warning):
          df = load_spark_df(
              spark,
              size=size,
              local_cache_path=tmp,
              header=header,
              title_col="Title",
              genres_col="Genres",
              year_col="Year",
          )
          assert df.count() == num_samples
          assert (
              len(df.columns) == 7
          )  # 4 header columns (user, item, rating, timestamp) and 3 feature columns
          assert (
              "e" not in df.columns
          )  # only the first 4 header columns are used
          # Get two records of the same items and check if the item-features are the same.
          head = df.filter(col("b") == movie_example).limit(2)
          title = head.select("Title").collect()
          assert title[0][0] == title[1][0]
          assert title[0][0] == title_example
          genres = head.select("Genres").collect()
          assert genres[0][0] == genres[1][0]
          assert genres[0][0] == genres_example
          year = head.select("Year").collect()
          assert year[0][0] == year[1][0]
          assert year[0][0] == year_example
  
      # Test default arguments
      df = load_spark_df(spark, size)
      assert df.count() == num_samples
      # user, item, rating and timestamp
      assert len(df.columns) == 4
      del df
      gc.collect()
  
imports: import os
  import gc
  import pandas
  from pandas.core.series import Series
  import pytest
  from pytest_mock import MockerFixture
  from recommenders.utils.constants import DEFAULT_GENRE_COL, DEFAULT_TITLE_COL
  from recommenders.datasets.movielens import MockMovielensSchema
  from recommenders.datasets.movielens import load_pandas_df, load_spark_df, load_item_df, download_movielens, extract_movielens
  from recommenders.datasets.movielens import DATA_FORMAT, MOCK_DATA_FORMAT, DEFAULT_HEADER, DEFAULT_ITEM_COL, DEFAULT_USER_COL
label_desc: Use image node_id 16 for calling a global function with example usage: test_load_spark_df(size, num_samples, num_movies, movie_example, title_example, genres_example, year_example, tmp, spark) without return types