code: import lancedb
  
  import numpy as np
  import pandas as pd
  import pytest
  import subprocess
  from main import get_recommendations, data
  import main
  
  # DOWNLOAD ======================================================
  
  subprocess.Popen(
      "curl https://files.grouplens.org/datasets/movielens/ml-latest-small.zip -o ml-latest-small.zip",
      shell=True,
  ).wait()
  subprocess.Popen("unzip ml-latest-small.zip", shell=True).wait()
  
  # TESTING ======================================================
  
  
  def test_main():
      ratings = pd.read_csv(
          "./ml-latest-small/ratings.csv",
          header=None,
          names=["user id", "movie id", "rating", "timestamp"],
      )
      ratings = ratings.drop(columns=["timestamp"])
      ratings = ratings.drop(0)
      ratings["rating"] = ratings["rating"].values.astype(np.float32)
      ratings["user id"] = ratings["user id"].values.astype(np.int32)
      ratings["movie id"] = ratings["movie id"].values.astype(np.int32)
  
      reviewmatrix = ratings.pivot(
          index="user id", columns="movie id", values="rating"
      ).fillna(0)
  
      # SVD
      matrix = reviewmatrix.values
      u, s, vh = np.linalg.svd(matrix, full_matrices=False)
  
      vectors = np.rot90(np.fliplr(vh))
      print(vectors.shape)
  
      # Metadata
      movies = pd.read_csv(
          "./ml-latest-small/movies.csv", header=0, names=["movie id", "title", "genres"]
      )
      movies = movies[movies["movie id"].isin(reviewmatrix.columns)]
  
      for i in range(len(movies)):
          data.append(
              {
                  "id": movies.iloc[i]["movie id"],
                  "title": movies.iloc[i]["title"],
                  "vector": vectors[i],
                  "genre": movies.iloc[i]["genres"],
              }
          )
      print(pd.DataFrame(data))
  
      # Connect to LanceDB
  
      db = lancedb.connect("./data/test-db")
      try:
          main.table = db.create_table("movie_set", data=data)
      except:
          main.table = db.open_table("movie_set")
  
      print(get_recommendations("Moana (2016)"))
      print(get_recommendations("Rogue One: A Star Wars Story (2016)"))
  
apis: lancedb.connect
extract_api: [((519, 634), 'pandas.read_csv', 'pd.read_csv', (['"""./ml-latest-small/ratings.csv"""'], {'header': 'None', 'names': "['user id', 'movie id', 'rating', 'timestamp']"}), "('./ml-latest-small/ratings.csv', header=None, names=['user id',\n    'movie id', 'rating', 'timestamp'])\n", (530, 634), True, 'import pandas as pd\n'), ((1119, 1161), 'numpy.linalg.svd', 'np.linalg.svd', (['matrix'], {'full_matrices': '(False)'}), '(matrix, full_matrices=False)\n', (1132, 1161), True, 'import numpy as np\n'), ((1255, 1351), 'pandas.read_csv', 'pd.read_csv', (['"""./ml-latest-small/movies.csv"""'], {'header': '(0)', 'names': "['movie id', 'title', 'genres']"}), "('./ml-latest-small/movies.csv', header=0, names=['movie id',\n    'title', 'genres'])\n", (1266, 1351), True, 'import pandas as pd\n'), ((1777, 1810), 'lancedb.connect', 'lancedb.connect', (['"""./data/test-db"""'], {}), "('./data/test-db')\n", (1792, 1810), False, 'import lancedb\n'), ((210, 346), 'subprocess.Popen', 'subprocess.Popen', (['"""curl https://files.grouplens.org/datasets/movielens/ml-latest-small.zip -o ml-latest-small.zip"""'], {'shell': '(True)'}), "(\n    'curl https://files.grouplens.org/datasets/movielens/ml-latest-small.zip -o ml-latest-small.zip'\n    , shell=True)\n", (226, 346), False, 'import subprocess\n'), ((355, 412), 'subprocess.Popen', 'subprocess.Popen', (['"""unzip ml-latest-small.zip"""'], {'shell': '(True)'}), "('unzip ml-latest-small.zip', shell=True)\n", (371, 412), False, 'import subprocess\n'), ((1186, 1199), 'numpy.fliplr', 'np.fliplr', (['vh'], {}), '(vh)\n', (1195, 1199), True, 'import numpy as np\n'), ((1471, 1614), 'main.data.append', 'data.append', (["{'id': movies.iloc[i]['movie id'], 'title': movies.iloc[i]['title'],\n    'vector': vectors[i], 'genre': movies.iloc[i]['genres']}"], {}), "({'id': movies.iloc[i]['movie id'], 'title': movies.iloc[i][\n    'title'], 'vector': vectors[i], 'genre': movies.iloc[i]['genres']})\n", (1482, 1614), False, 'from main import get_recommendations, data\n'), ((1721, 1739), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (1733, 1739), True, 'import pandas as pd\n'), ((1952, 1987), 'main.get_recommendations', 'get_recommendations', (['"""Moana (2016)"""'], {}), "('Moana (2016)')\n", (1971, 1987), False, 'from main import get_recommendations, data\n'), ((1999, 2057), 'main.get_recommendations', 'get_recommendations', (['"""Rogue One: A Star Wars Story (2016)"""'], {}), "('Rogue One: A Star Wars Story (2016)')\n", (2018, 2057), False, 'from main import get_recommendations, data\n')]