MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_rec_fairy_adapted_dialect

Method test_rec_fairy_adapted_dialect

test/engine/test_pool.py:355–381  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

353 is_(fairy.driver_connection, rec.driver_connection)
354
355 def test_rec_fairy_adapted_dialect(self):
356 dbapi = MockDBAPI()
357
358 mock_dc = object()
359
360 class _AdaptedDialect(_ConnDialect):
361 def get_driver_connection(self, connection):
362 return mock_dc
363
364 p1 = pool.Pool(
365 creator=lambda: dbapi.connect("foo.db"), dialect=_AdaptedDialect()
366 )
367
368 rec = pool._ConnectionRecord(p1)
369
370 assert rec.dbapi_connection is not None
371 is_not_none(rec.dbapi_connection)
372
373 is_(rec.driver_connection, mock_dc)
374
375 fairy = pool._ConnectionFairy(p1, rec.dbapi_connection, rec, False)
376
377 is_not_none(fairy.dbapi_connection)
378 is_(fairy.driver_connection, mock_dc)
379
380 is_(fairy.dbapi_connection, rec.dbapi_connection)
381 is_(fairy.driver_connection, mock_dc)
382
383
384class PoolDialectTest(PoolTestBase):

Callers

nothing calls this directly

Calls 5

is_not_noneFunction · 0.90
is_Function · 0.90
_AdaptedDialectClass · 0.85
MockDBAPIFunction · 0.70
connectMethod · 0.45

Tested by

no test coverage detected