MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_ddl_hastable

Method test_ddl_hastable

test/engine/test_execute.py:1215–1244  ·  view source on GitHub ↗
(self, plain_tables, connection)

Source from the content-addressed store, hash-verified

1213 )
1214
1215 def test_ddl_hastable(self, plain_tables, connection):
1216 map_ = {
1217 None: config.test_schema,
1218 "foo": config.test_schema,
1219 "bar": None,
1220 }
1221
1222 metadata = MetaData()
1223 Table("t1", metadata, Column("x", Integer))
1224 Table("t2", metadata, Column("x", Integer), schema="foo")
1225 Table("t3", metadata, Column("x", Integer), schema="bar")
1226
1227 conn = connection.execution_options(schema_translate_map=map_)
1228 metadata.create_all(conn)
1229
1230 insp = inspect(connection)
1231 is_true(insp.has_table("t1", schema=config.test_schema))
1232 is_true(insp.has_table("t2", schema=config.test_schema))
1233 is_true(insp.has_table("t3", schema=None))
1234
1235 conn = connection.execution_options(schema_translate_map=map_)
1236
1237 # if this test fails, the tables won't get dropped. so need a
1238 # more robust fixture for this
1239 metadata.drop_all(conn)
1240
1241 insp = inspect(connection)
1242 is_false(insp.has_table("t1", schema=config.test_schema))
1243 is_false(insp.has_table("t2", schema=config.test_schema))
1244 is_false(insp.has_table("t3", schema=None))
1245
1246 def test_option_on_execute(self, plain_tables, connection):
1247 # provided by metadata fixture provided by plain_tables fixture

Callers

nothing calls this directly

Calls 10

create_allMethod · 0.95
drop_allMethod · 0.95
MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
inspectFunction · 0.90
is_trueFunction · 0.90
is_falseFunction · 0.90
execution_optionsMethod · 0.45
has_tableMethod · 0.45

Tested by

no test coverage detected