def test_module_exceptions():
 normal_types = ['sys', 'clr', 'exceptions', '__builtin__', '_winreg', 'mmap', 'nt', 'posix']
 builtins = [x for x in sys.builtin_module_names if (x not in normal_types)]
 for module in builtins:
  mod = __import__(module)
  for attrName in dir(mod):
   val = getattr(mod, attrName)
   if (isinstance(val, type) and issubclass(val, Exception)):
    if ('BlockingIOError' not in repr(val)):
     Assert(repr(val).startswith('<class '))
     val.x = 2
     AreEqual(val.x, 2)
    else:
     Assert(repr(val).startswith('<type '))

def test_module_exceptions ( ) : normal_types = [ 'sys' , 'clr' , 'exceptions' , '__builtin__' , '_winreg' , 'mmap' , 'nt' , 'posix' ] builtins = [ x for x in sys . builtin_module_names if ( x not in normal_types ) ] for module in builtins : mod = __import__ ( module ) for attrName in dir ( mod ) : val = getattr ( mod , attrName ) if ( isinstance ( val , type ) and issubclass ( val , Exception ) ) : if ( 'BlockingIOError' not in repr ( val ) ) : Assert ( repr ( val ) . startswith ( '<class ' ) ) val . x = 2 AreEqual ( val . x , 2 ) else : Assert ( repr ( val ) . startswith ( '<type ' ) )
verify exceptions in modules are like user defined exception objects .