Пример #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
     )