code: def test_train_test_split(ray_start_regular_shared):
      ds = ray.data.range(8)
  
      # float
      train, test = ds.train_test_split(test_size=0.25)
      assert extract_values("id", train.take()) == [0, 1, 2, 3, 4, 5]
      assert extract_values("id", test.take()) == [6, 7]
  
      # int
      train, test = ds.train_test_split(test_size=2)
      assert extract_values("id", train.take()) == [0, 1, 2, 3, 4, 5]
      assert extract_values("id", test.take()) == [6, 7]
  
      # shuffle
      train, test = ds.train_test_split(
          test_size=0.25, shuffle=True, seed=1
      )
      assert extract_values("id", train.take()) == [4, 5, 3, 2, 7, 6]
      assert extract_values("id", test.take()) == [0, 1]
  
      # error handling
      with pytest.raises(TypeError):
          ds.train_test_split(test_size=[1])
  
      with pytest.raises(ValueError):
          ds.train_test_split(test_size=-1)
  
      with pytest.raises(ValueError):
          ds.train_test_split(test_size=0)
  
      with pytest.raises(ValueError):
          ds.train_test_split(test_size=1.1)
  
      with pytest.raises(ValueError):
          ds.train_test_split(test_size=9)
  
imports: import itertools
  import math
  import random
  import time
  from unittest.mock import patch
  import numpy
  import pandas
  import pytest
  import ray
  from ray.data._internal.block_list import BlockList
  from ray.data._internal.equalize import _equalize
  from ray.data._internal.execution.interfaces import RefBundle
  from ray.data._internal.logical.interfaces import LogicalPlan
  from ray.data._internal.logical.operators.input_data_operator import InputData
  from ray.data._internal.plan import ExecutionPlan
  from ray.data._internal.split import _drop_empty_block_split, _generate_global_split_results, _generate_per_block_split_indices, _generate_valid_indices, _split_at_indices, _split_single_block
  from ray.data._internal.stats import DatasetStats
  from ray.data.block import BlockAccessor, BlockMetadata
  from ray.data.dataset import Dataset
  from ray.data.tests.conftest import *
  from ray.data.tests.util import extract_values
  from ray.tests.conftest import *
label_desc: Use image node_id 27 for calling a global function with example usage: test_train_test_split(ray_start_regular_shared) without return types