code: def test_unknown_user_or_item(toy_data):
      """Ensure that all algorithms act gracefully when asked to predict a rating
      of an unknown user, an unknown item, and when both are unknown.
      """
  
      trainset = toy_data.build_full_trainset()
  
      klasses = (
          NormalPredictor,
          BaselineOnly,
          KNNBasic,
          KNNWithMeans,
          KNNBaseline,
          SVD,
          SVDpp,
          NMF,
          SlopeOne,
          CoClustering,
          KNNWithZScore,
      )
      for klass in klasses:
          algo = klass()
          algo.fit(trainset)
          algo.predict("user0", "unknown_item", None)
          algo.predict("unknown_user", "item0", None)
          algo.predict("unknown_user", "unknown_item", None)
  
      # unrelated, but test the fit().test() one-liner:
      trainset, testset = train_test_split(toy_data, test_size=2)
      for klass in klasses:
          algo = klass()
          algo.fit(trainset).test(testset)
  
imports: import os
  import pytest
  from surprise import accuracy, BaselineOnly, CoClustering, Dataset, KNNBaseline, KNNBasic, KNNWithMeans, KNNWithZScore, NMF, NormalPredictor, Reader, SlopeOne, SVD, SVDpp
  from surprise.model_selection import train_test_split
label_desc: Use image node_id 1 for calling a global function with example usage: test_unknown_user_or_item(toy_data) without return types