<s> import unittest <EOL> from copperhead import * <EOL> from recursive_equal import recursive_equal <EOL> class TupleData ( unittest . TestCase ) : <EOL> def testTypeTupleScalars ( self ) : <EOL> source = ( <NUM_LIT:1> , <NUM_LIT> ) <EOL> result_type , result_value = runtime . driver . induct ( source ) <EOL> self . assertEqual ( repr ( result_type ) , "<STR_LIT>" ) <EOL> def testTypeTupleSequences ( self ) : <EOL> source = ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT> , <NUM_LIT> ] ) <EOL> result_type , result_value = runtime . driver . induct ( source ) <EOL> self . assertEqual ( repr ( result_type ) , "<STR_LIT>" ) <EOL> def testTypeNestedTuple ( self ) : <EOL> source = ( <NUM_LIT:1> , ( <NUM_LIT:2> , <NUM_LIT> , ( <NUM_LIT> , <NUM_LIT:5> ) ) , <NUM_LIT> ) <EOL> result_type , result_value = runtime . driver . induct ( source ) <EOL> self . assertEqual ( repr ( result_type ) , "<STR_LIT>" ) <EOL> @ cu <EOL> def test_tuple ( ( m , n ) , b ) : <EOL> """<STR_LIT>""" <EOL> q , r = m , n <EOL> s = q , r <EOL> t , u = s <EOL> o , p = b <EOL> return t + o , u + p <EOL> @ cu <EOL> def test_tuple_return ( ) : <EOL> """<STR_LIT>""" <EOL> a = <NUM_LIT:1> , <NUM_LIT:2> <EOL> return a <EOL> @ cu <EOL> def test_nested_tuple_return ( ) : <EOL> return ( <NUM_LIT:1> , ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> @ cu <EOL> def test_tuple_seq ( x , y ) : <EOL> return x , y <EOL> @ cu <EOL> def test_containerize ( x ) : <EOL> def sub ( xi ) : <EOL> return - xi <EOL> y = map ( sub , x ) <EOL> z = x , y <EOL> return z <EOL> @ cu <EOL> def test_tuple_seq_args ( x ) : <EOL> y , z = x <EOL> return y , z <EOL> class TupleExtract ( unittest . TestCase ) : <EOL> def testTuple ( self ) : <EOL> source_a = ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> source_b = ( <NUM_LIT:5> , <NUM_LIT:6> ) <EOL> golden = ( <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> self . assertEqual ( test_tuple ( source_a , source_b ) , golden ) <EOL> def testNestedTupleReturn ( self ) : <EOL> self . assertTrue ( <EOL> recursive_equal ( test_nested_tuple_return ( ) , ( <NUM_LIT:1> , ( <NUM_LIT:2> , <NUM_LIT:3> ) ) ) ) <EOL> def testTupleReturn ( self ) : <EOL> self . assertEqual ( test_tuple_return ( ) , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> def testTupleSeqSeq ( self ) : <EOL> self . assertTrue ( recursive_equal ( test_tuple_seq ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ) , ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ) ) ) <EOL> def testTupleSeqScalar ( self ) : <EOL> self . assertTrue ( recursive_equal ( test_tuple_seq ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , <NUM_LIT:3> ) , ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , <NUM_LIT:3> ) ) ) <EOL> def testTupleSeqTuple ( self ) : <EOL> self . assertTrue ( recursive_equal ( test_tuple_seq ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , ( <NUM_LIT:3> , <NUM_LIT:4> ) ) , ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , ( <NUM_LIT:3> , <NUM_LIT:4> ) ) ) ) <EOL> def testTupleSeqArgs ( self ) : <EOL> self . assertTrue ( recursive_equal ( test_tuple_seq_args ( ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ) ) , <EOL> ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ) ) ) <EOL> def testContainerize ( self ) : <EOL> self . assertTrue ( recursive_equal ( test_containerize ( [ <NUM_LIT:1> , <NUM_LIT:2> ] ) , ( [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ - <NUM_LIT:1> , - <NUM_LIT:2> ] ) ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
