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

def assertRaisesRegexp ( _exception , _regexp , _callable = None , * args , ** kwargs ) : manager = _AssertRaisesContextmanager ( exception = _exception , regexp = _regexp ) if ( _callable is not None ) : with manager : _callable ( * args , ** kwargs ) else : return manager
port of assertraisesregexp from unittest in python 2 .