MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_ddl_hastable

Method test_ddl_hastable

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

Source from the content-addressed store, hash-verified

1153 )
1154
1155 def test_ddl_hastable(self, plain_tables, connection):
1156 map_ = {
1157 None: config.test_schema,
1158 "foo": config.test_schema,
1159 "bar": None,
1160 }
1161
1162 metadata = MetaData()
1163 Table("t1", metadata, Column("x", Integer))
1164 Table("t2", metadata, Column("x", Integer), schema="foo")
1165 Table("t3", metadata, Column("x", Integer), schema="bar")
1166
1167 conn = connection.execution_options(schema_translate_map=map_)
1168 metadata.create_all(conn)
1169
1170 insp = inspect(connection)
1171 is_true(insp.has_table("t1", schema=config.test_schema))
1172 is_true(insp.has_table("t2", schema=config.test_schema))
1173 is_true(insp.has_table("t3", schema=None))
1174
1175 conn = connection.execution_options(schema_translate_map=map_)
1176
1177 # if this test fails, the tables won't get dropped. so need a
1178 # more robust fixture for this
1179 metadata.drop_all(conn)
1180
1181 insp = inspect(connection)
1182 is_false(insp.has_table("t1", schema=config.test_schema))
1183 is_false(insp.has_table("t2", schema=config.test_schema))
1184 is_false(insp.has_table("t3", schema=None))
1185
1186 def test_option_on_execute(self, plain_tables, connection):
1187 # 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