def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: callable_(*args, **kwargs) assert False, "Callable did not raise an exception" except except_cls as e: assert re.search( msg, text_type(e), re.UNICODE), "%r !~ %s" % (msg, e) print(text_type(e).encode('utf-8'))
def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: callable_(*args, **kwargs) assert False, "Callable did not raise an exception" except except_cls as e: assert re.search(msg, text_type(e), re.UNICODE), "%r !~ %s" % (msg, e) print(text_type(e).encode('utf-8'))
def assert_compiled(element, assert_string, dialect=None): dialect = _get_dialect(dialect) eq_( text_type(element.compile(dialect=dialect)). replace("\n", "").replace("\t", ""), assert_string.replace("\n", "").replace("\t", "") )
def _exec(self, construct, *args, **kw): if isinstance(construct, string_types): construct = text(construct) assert construct.supports_execution sql = text_type(construct.compile(dialect=self.dialect)) sql = re.sub(r'[\n\t]', '', sql) self.assertion.append(sql)
def assert_raises_message(except_cls, msg, callable_, *args, **kwargs): try: callable_(*args, **kwargs) assert False, "Callable did not raise an exception" except except_cls as e: assert re.search(msg, str(e)), "%r !~ %s" % (msg, e) print(text_type(e))
def assert_compiled(element, assert_string, dialect=None): dialect = _get_dialect(dialect) eq_( text_type(element.compile(dialect=dialect)).\ replace("\n", "").replace("\t", ""), assert_string.replace("\n", "").replace("\t", "") )
def execute(stmt, *multiparam, **param): if isinstance(stmt, string_types): stmt = text(stmt) assert stmt.supports_execution sql = text_type(stmt.compile(dialect=ctx_dialect)) buf.write(sql)
def _exec(self, construct, *args, **kw): if isinstance(construct, string_types): construct = text(construct) sql = text_type(construct.compile(dialect=self.dialect)) sql = re.sub(r'[\n\t]', '', sql) self.assertion.append( sql )