def assert_raises_regexp(exception, reg, run, *args, **kwargs):
 __tracebackhide__ = True
 try:
  run(*args, **kwargs)
  assert False, ('%s should have been thrown' % exception)
 except exception:
  e = sys.exc_info()[1]
  p = re.compile(reg)
  assert p.search(str(e)), str(e)

def assert_raises_regexp ( exception , reg , run , * args , ** kwargs ) : __tracebackhide__ = True try : run ( * args , ** kwargs ) assert False , ( '%s should have been thrown' % exception ) except exception : e = sys . exc_info ( ) [ 1 ] p = re . compile ( reg ) assert p . search ( str ( e ) ) , str ( e )
check for usage of deprecated assertraisesregexp n335 .