<s> from odo . utils import ext , iter_except , keywords , gentemp , records_to_tuples <EOL> def test_ext ( ) : <EOL> assert ext ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> assert ext ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> assert ext ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_iter_except ( ) : <EOL> s = set ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> def iterate ( ) : <EOL> yield <NUM_LIT:1> <EOL> yield <NUM_LIT:2> <EOL> yield <NUM_LIT:4> <EOL> elems = iterate ( ) <EOL> inset = iter_except ( lambda : next ( elems ) in s , StopIteration ) <EOL> assert list ( inset ) == [ True , True , False ] <EOL> def test_keywords ( ) : <EOL> assert keywords ( keywords ) == [ "<STR_LIT>" ] <EOL> def test_gentemp ( ) : <EOL> i , _ , data = next ( gentemp ( [ [ <NUM_LIT:1> , <NUM_LIT:2> ] , [ <NUM_LIT:3> , <NUM_LIT:4> ] ] , start = <NUM_LIT:1> ) ) <EOL> assert i == <NUM_LIT:1> and data == [ <NUM_LIT:1> , <NUM_LIT:2> ] <EOL> def test_records_to_tuples ( ) : <EOL> seq = [ { '<STR_LIT:i>' : <NUM_LIT:1> , '<STR_LIT:f>' : <NUM_LIT:1.0> } , { '<STR_LIT:i>' : <NUM_LIT:2> , '<STR_LIT:f>' : <NUM_LIT> } ] <EOL> lst = list ( records_to_tuples ( '<STR_LIT>' , seq ) ) <EOL> assert lst == [ ( <NUM_LIT:1> , <NUM_LIT:1.0> ) , ( <NUM_LIT:2> , <NUM_LIT> ) ] <EOL> def test_records_to_tuples_mismatch_passthrough ( ) : <EOL> assert records_to_tuples ( '<STR_LIT>' , '<STR_LIT>' ) == '<STR_LIT>' </s>
