<s> from unittest import TestCase <EOL> from multimodal . lib . utils import random_split , leave_one_out <EOL> class TestRandomSplit ( TestCase ) : <EOL> n = <NUM_LIT> <EOL> ratio = <NUM_LIT> <EOL> def test_returns_train_test ( self ) : <EOL> self . assertTrue ( all ( [ len ( x ) == <NUM_LIT:2> <EOL> for x in random_split ( self . n , self . ratio ) ] ) ) <EOL> def test_returns_10_sets ( self ) : <EOL> self . assertEqual ( <NUM_LIT:10> , len ( [ x for x in random_split ( self . n , <NUM_LIT> ) ] ) ) <EOL> def test_returns_9_sets ( self ) : <EOL> self . assertEqual ( <NUM_LIT:9> , len ( [ x for x in random_split ( self . n , <NUM_LIT> ) ] ) ) <EOL> def test_are_disjoint ( self ) : <EOL> self . assertTrue ( all ( <EOL> [ set ( test ) . isdisjoint ( set ( train ) ) <EOL> for train , test in random_split ( self . n , self . ratio ) ] ) ) <EOL> def test_have_all_same_size ( self ) : <EOL> sizes = [ ( len ( train ) , len ( test ) ) <EOL> for train , test in random_split ( self . n , self . ratio ) ] <EOL> self . assertEqual ( len ( set ( sizes ) ) , <NUM_LIT:1> ) <EOL> class TestRandomSplit2 ( TestRandomSplit ) : <EOL> n = <NUM_LIT> <EOL> class TestLeaveOneOut ( TestCase ) : <EOL> n = <NUM_LIT> <EOL> def test_returns_train_test ( self ) : <EOL> self . assertTrue ( all ( [ len ( x ) == <NUM_LIT:2> for x in leave_one_out ( self . n ) ] ) ) <EOL> def test_returns_37_sets ( self ) : <EOL> self . assertEqual ( <NUM_LIT> , len ( [ x for x in leave_one_out ( self . n ) ] ) ) <EOL> def test_are_disjoint ( self ) : <EOL> self . assertTrue ( all ( [ set ( test ) . isdisjoint ( set ( train ) ) <EOL> for train , test in leave_one_out ( self . n ) ] ) ) <EOL> def test_have_all_same_size ( self ) : <EOL> sizes = [ ( len ( train ) , len ( test ) ) <EOL> for train , test in leave_one_out ( self . n ) ] <EOL> self . assertEqual ( len ( set ( sizes ) ) , <NUM_LIT:1> ) </s>
