<s> import math <EOL> def type_trunc ( type , arg ) : <EOL> try : <EOL> print type . __trunc__ ( arg ) <EOL> except TypeError as e : <EOL> print e <EOL> type_trunc ( float , <NUM_LIT> ) <EOL> type_trunc ( float , <NUM_LIT:5> ) <EOL> type_trunc ( float , <NUM_LIT:5> L ) <EOL> type_trunc ( float , "<STR_LIT:5>" ) <EOL> type_trunc ( int , <NUM_LIT> ) <EOL> type_trunc ( int , <NUM_LIT:5> ) <EOL> type_trunc ( int , <NUM_LIT:5> L ) <EOL> type_trunc ( int , "<STR_LIT:5>" ) <EOL> type_trunc ( long , <NUM_LIT> ) <EOL> type_trunc ( long , <NUM_LIT:5> ) <EOL> type_trunc ( long , <NUM_LIT:5> L ) <EOL> type_trunc ( long , "<STR_LIT:5>" ) <EOL> class Test : <EOL> def __trunc__ ( self ) : <EOL> print "<STR_LIT>" <EOL> return <NUM_LIT:5> <EOL> t = Test ( ) <EOL> print math . trunc ( t ) <EOL> class TruncReturnsNonInt : <EOL> def __trunc__ ( self ) : <EOL> print "<STR_LIT>" <EOL> return "<STR_LIT>" <EOL> t2 = TruncReturnsNonInt ( ) <EOL> print math . trunc ( t2 ) </s>
