def assertRaises(_exception, _callable=None, *args, **kwargs):
 manager = _AssertRaisesContextmanager(exception=_exception)
 if (_callable is not None):
  with manager:
   _callable(*args, **kwargs)
 else:
  return manager

def assertRaises ( _exception , _callable = None , * args , ** kwargs ) : manager = _AssertRaisesContextmanager ( exception = _exception ) if ( _callable is not None ) : with manager : _callable ( * args , ** kwargs ) else : return manager
assertraises that is usable as context manager or in a with statement exceptions that dont match the given exception type fall through:: .