示例#1
0
 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'))
示例#2
0
 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'))
示例#3
0
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", "")
    )
示例#4
0
 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)
示例#5
0
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))
示例#6
0
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", "")
    )
示例#7
0
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))
示例#8
0
        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)
示例#9
0
 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
     )