def assert_warnings(fn, warning_msgs, regex=False):
 with assertions._expect_warnings(sa_exc.SAWarning, warning_msgs, regex=regex):
  return fn()

def assert_warnings ( fn , warning_msgs , regex = False ) : with assertions . _expect_warnings ( sa_exc . SAWarning , warning_msgs , regex = regex ) : return fn ( )
assert that each of the given warnings are emitted by fn .