MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _fixture

Method _fixture

test/sql/test_metadata.py:5295–5324  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5293class DialectKWArgTest(fixtures.TestBase):
5294 @contextmanager
5295 def _fixture(self):
5296 from sqlalchemy.engine.default import DefaultDialect
5297
5298 class ParticipatingDialect(DefaultDialect):
5299 construct_arguments = [
5300 (schema.Index, {"x": 5, "y": False, "z_one": None}),
5301 (schema.ForeignKeyConstraint, {"foobar": False}),
5302 ]
5303
5304 class ParticipatingDialect2(DefaultDialect):
5305 construct_arguments = [
5306 (schema.Index, {"x": 9, "y": True, "pp": "default"}),
5307 (schema.Table, {"*": None}),
5308 ]
5309
5310 class NonParticipatingDialect(DefaultDialect):
5311 construct_arguments = None
5312
5313 def load(dialect_name):
5314 if dialect_name == "participating":
5315 return ParticipatingDialect
5316 elif dialect_name == "participating2":
5317 return ParticipatingDialect2
5318 elif dialect_name == "nonparticipating":
5319 return NonParticipatingDialect
5320 else:
5321 raise exc.NoSuchModuleError("no dialect %r" % dialect_name)
5322
5323 with mock.patch("sqlalchemy.dialects.registry.load", load):
5324 yield
5325
5326 def teardown_test(self):
5327 Index._kw_registry.clear()

Calls

no outgoing calls

Tested by

no test coverage detected