code: def test_train_test_split(toy_data):
      # test test_size to int and train_size to None (complement)
      trainset, testset = train_test_split(
          toy_data, test_size=2, train_size=None
      )
      assert len(testset) == 2
      assert trainset.n_ratings == 3
  
      # test test_size to float and train_size to None (complement)
      trainset, testset = train_test_split(
          toy_data, test_size=0.2, train_size=None
      )
      assert len(testset) == 1
      assert trainset.n_ratings == 4
  
      # test test_size to int and train_size to int
      trainset, testset = train_test_split(
          toy_data, test_size=2, train_size=3
      )
      assert len(testset) == 2
      assert trainset.n_ratings == 3
  
      # test test_size to None (complement) and train_size to int
      trainset, testset = train_test_split(
          toy_data, test_size=None, train_size=2
      )
      assert len(testset) == 3
      assert trainset.n_ratings == 2
  
      # test test_size to None (complement) and train_size to float
      trainset, testset = train_test_split(
          toy_data, test_size=None, train_size=0.2
      )
      assert len(testset) == 4
      assert trainset.n_ratings == 1
  
      # Test random_state parameter
      # If random_state is None, you get different split each time (conditioned
      # by rng of course)
  
      testsets = set()
      # TODO: all  other tests should use similar logic instead of just 1 single try
      for _ in range(30):
          _, testset = train_test_split(toy_data, random_state=None)
          testsets.add(tuple(testset))
      assert len(testsets) > 1
  
      # Repeated called to split when random_state is set lead to the same folds
      _, testset_a = train_test_split(toy_data, random_state=1)
      _, testset_b = train_test_split(toy_data, random_state=1)
      assert testset_a == testset_b
  
      # Test shuffle parameter, if False then splits are the same regardless of
      # random_state.
      _, testset_a = train_test_split(
          toy_data, random_state=1, shuffle=None
      )
      _, testset_b = train_test_split(
          toy_data, random_state=1, shuffle=None
      )
      assert testset_a == testset_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 3 for calling a global function with example usage: test_train_test_split(toy_data) without return types