code: def test_ShuffleSplit(toy_data):
      with pytest.raises(ValueError):
          ss = ShuffleSplit(n_splits=0)
  
      with pytest.raises(ValueError):
          ss = ShuffleSplit(test_size=10)
          next(ss.split(toy_data))
  
      with pytest.raises(ValueError):
          ss = ShuffleSplit(train_size=10)
          next(ss.split(toy_data))
  
      with pytest.raises(ValueError):
          ss = ShuffleSplit(test_size=3, train_size=3)
          next(ss.split(toy_data))
  
      with pytest.raises(ValueError):
          ss = ShuffleSplit(test_size=3, train_size=0)
          next(ss.split(toy_data))
  
      with pytest.raises(ValueError):
          ss = ShuffleSplit(test_size=0, train_size=3)
          next(ss.split(toy_data))
  
      # No need to cover the entire dataset
      ss = ShuffleSplit(test_size=1, train_size=1)
      next(ss.split(toy_data))
  
      # test test_size to int and train_size to None (complement)
      ss = ShuffleSplit(test_size=1)
      assert all(
          len(testset) == 1 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 4
          for (trainset, _) in ss.split(toy_data)
      )
  
      # test test_size to float and train_size to None (complement)
      ss = ShuffleSplit(test_size=0.2)  # 20% of 5 = 1
      assert all(
          len(testset) == 1 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 4
          for (trainset, _) in ss.split(toy_data)
      )
  
      # test test_size to int and train_size to int
      ss = ShuffleSplit(test_size=2, train_size=2)
      assert all(
          len(testset) == 2 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 2
          for (trainset, _) in ss.split(toy_data)
      )
  
      # test test_size to None (complement) and train_size to int
      ss = ShuffleSplit(test_size=None, train_size=2)
      assert all(
          len(testset) == 3 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 2
          for (trainset, _) in ss.split(toy_data)
      )
  
      # test test_size to None (complement) and train_size to float
      ss = ShuffleSplit(test_size=None, train_size=0.2)
      assert all(
          len(testset) == 4 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 1
          for (trainset, _) in ss.split(toy_data)
      )
  
      # test default parameters: 5 splits, test_size = .2, train_size = None
      ss = ShuffleSplit()
      assert len(list(ss.split(toy_data))) == 5
      assert all(
          len(testset) == 1 for (_, testset) in ss.split(toy_data)
      )
      assert all(
          trainset.n_ratings == 4
          for (trainset, _) in ss.split(toy_data)
      )
  
      # Test random_state parameter
      # If random_state is None, you get different split each time (conditioned
      # by rng of course)
      ss = ShuffleSplit(random_state=None)
      testsets_a = [testset for (_, testset) in ss.split(toy_data)]
      testsets_b = [testset for (_, testset) in ss.split(toy_data)]
      assert testsets_a != testsets_b
      # Repeated called to split when random_state is set lead to the same folds
      ss = ShuffleSplit(random_state=1)
      testsets_a = [testset for (_, testset) in ss.split(toy_data)]
      testsets_b = [testset for (_, testset) in ss.split(toy_data)]
      assert testsets_a == testsets_b
  
      # Test shuffle parameter, if False then splits are the same regardless of
      # random_state.
      ss = ShuffleSplit(random_state=1, shuffle=False)
      testsets_a = [testset for (_, testset) in ss.split(toy_data)]
      testsets_b = [testset for (_, testset) in ss.split(toy_data)]
      assert testsets_a == testsets_b
  
file_path: Surprise/tests/test_split.py
imports: import os
  from collections import Counter
  from copy import copy
  import numpy
  import pytest
  from surprise import Dataset, Reader
  from surprise.model_selection import KFold, LeaveOneOut, PredefinedKFold, RepeatedKFold, ShuffleSplit, train_test_split
  from surprise.model_selection.split import get_cv
label_desc: Use image node_id 2 for calling a global function with example usage: test_ShuffleSplit(toy_data) without return types