<s> from test . support import run_unittest <EOL> import unittest <EOL> class OpcodeTest ( unittest . TestCase ) : <EOL> def test_try_inside_for_loop ( self ) : <EOL> n = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> n = n + i <EOL> try : <NUM_LIT:1> / <NUM_LIT:0> <EOL> except NameError : pass <EOL> except ZeroDivisionError : pass <EOL> except TypeError : pass <EOL> try : pass <EOL> except : pass <EOL> try : pass <EOL> finally : pass <EOL> n = n + i <EOL> if n != <NUM_LIT> : <EOL> self . fail ( '<STR_LIT>' ) <EOL> def test_raise_class_exceptions ( self ) : <EOL> class AClass ( Exception ) : pass <EOL> class BClass ( AClass ) : pass <EOL> class CClass ( Exception ) : pass <EOL> class DClass ( AClass ) : <EOL> def __init__ ( self , ignore ) : <EOL> pass <EOL> try : raise AClass ( ) <EOL> except : pass <EOL> try : raise AClass ( ) <EOL> except AClass : pass <EOL> try : raise BClass ( ) <EOL> except AClass : pass <EOL> try : raise BClass ( ) <EOL> except CClass : self . fail ( ) <EOL> except : pass <EOL> a = AClass ( ) <EOL> b = BClass ( ) <EOL> try : <EOL> raise b <EOL> except AClass as v : <EOL> self . assertEqual ( v , b ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> try : raise DClass ( a ) <EOL> except DClass as v : <EOL> self . assertIsInstance ( v , DClass ) <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_compare_function_objects ( self ) : <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> f = eval ( '<STR_LIT>' ) <EOL> g = eval ( '<STR_LIT>' ) <EOL> self . assertNotEqual ( f , g ) <EOL> def test_modulo_of_string_subclasses ( self ) : <EOL> class MyString ( str ) : <EOL> def __mod__ ( self , value ) : <EOL> return <NUM_LIT> <EOL> self . assertEqual ( MyString ( ) % <NUM_LIT:3> , <NUM_LIT> ) <EOL> def test_main ( ) : <EOL> run_unittest ( OpcodeTest ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_main ( ) </s>
