MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_is_disconnect

Method test_is_disconnect

test/dialect/mysql/test_dialect.py:327–343  ·  view source on GitHub ↗
(
        self, arg0, message, exc_cls_name, dialect_name, is_disconnect
    )

Source from the content-addressed store, hash-verified

325 (4032, "foo", "OperationalError", "pymysql", False),
326 )
327 def test_is_disconnect(
328 self, arg0, message, exc_cls_name, dialect_name, is_disconnect
329 ):
330 class Error(Exception):
331 pass
332
333 dbapi = mock.Mock()
334 dbapi.Error = Error
335 dbapi.ProgrammingError = type("ProgrammingError", (Error,), {})
336 dbapi.OperationalError = type("OperationalError", (Error,), {})
337 dbapi.InterfaceError = type("InterfaceError", (Error,), {})
338 dbapi.InternalError = type("InternalError", (Error,), {})
339
340 dialect = getattr(mysql, dialect_name).dialect(dbapi=dbapi)
341
342 error = getattr(dbapi, exc_cls_name)(arg0, message)
343 eq_(dialect.is_disconnect(error, None, None), is_disconnect)
344
345 @testing.combinations(
346 ("mysqldb"), ("pymysql"), id_="s", argnames="driver_name"

Callers

nothing calls this directly

Calls 3

eq_Function · 0.90
dialectMethod · 0.45
is_disconnectMethod · 0.45

Tested by

no test coverage detected