<s> class SlicingTestCases ( object ) : <EOL> """<STR_LIT>""" <EOL> def test_custom_slicing_1 ( self ) : <EOL> class ListWrapper_1 : <EOL> def __init__ ( self , m ) : <EOL> self . m = m <EOL> def __getitem__ ( self , maybeSlice ) : <EOL> if isinstance ( maybeSlice , slice ) : <EOL> return self . m [ maybeSlice ] <EOL> return - <NUM_LIT> <EOL> def f ( ) : <EOL> l = ListWrapper_1 ( range ( <NUM_LIT:10> ) ) <EOL> return ( l [ <NUM_LIT:1> : <NUM_LIT:4> ] , l [ : <NUM_LIT:3> ] , l [ : ] , l [ : : ] , l [ <NUM_LIT:3> : ] , l [ <NUM_LIT:4> : : <NUM_LIT:2> ] , l [ <NUM_LIT:4> ] ) <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_custom_slicing_2 ( self ) : <EOL> class ListWrapper_2 : <EOL> def __init__ ( self , m ) : <EOL> self . m = m <EOL> def __getitem__ ( self , maybeSlice ) : <EOL> if isinstance ( maybeSlice , slice ) : <EOL> return self . m [ maybeSlice ] <EOL> if isinstance ( maybeSlice , tuple ) : <EOL> return [ self . m [ bla ] for bla in maybeSlice ] <EOL> return - <NUM_LIT> <EOL> def f ( ) : <EOL> l = ListWrapper_2 ( range ( <NUM_LIT:10> ) ) <EOL> return l [ : , <NUM_LIT:1> : <NUM_LIT:4> , <NUM_LIT:3> : <NUM_LIT:9> ] <EOL> self . equivalentEvaluationTest ( f ) <EOL> def test_returning_slice_1 ( self ) : <EOL> def f1 ( ) : <EOL> return slice <EOL> self . equivalentEvaluationTest ( f1 ) <EOL> def test_inserting_slice_1 ( self ) : <EOL> def f ( ) : <EOL> s = slice ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> x = range ( <NUM_LIT:10> ) <EOL> return x [ s ] <EOL> self . equivalentEvaluationTest ( f ) </s>
