def assert_raises(exc_class, callable_obj, *args, **kwargs):
 try:
  callable_obj(*args, **kwargs)
 except exc_class as err:
  return err
 else:
  if hasattr(exc_class, '__name__'):
   exc_name = exc_class.__name__
  else:
   exc_name = str(exc_class)
  _report_failure(('%s not raised' % exc_name))

def assert_raises ( exc_class , callable_obj , * args , ** kwargs ) : try : callable_obj ( * args , ** kwargs ) except exc_class as err : return err else : if hasattr ( exc_class , '__name__' ) : exc_name = exc_class . __name__ else : exc_name = str ( exc_class ) _report_failure ( ( '%s not raised' % exc_name ) )
like unittest .