def raises_msg(exc, msg, func, *args, **kwds):
 with pytest.raises(exc) as excinfo:
  func(*args, **kwds)
 assert (msg in str(excinfo.value))

def raises_msg ( exc , msg , func , * args , ** kwds ) : with pytest . raises ( exc ) as excinfo : func ( * args , ** kwds ) assert ( msg in str ( excinfo . value ) )
raise :exc:assertionerror if func does not raise *exc* .