MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_tokens

Method test_tokens

test/engine/test_ddlevents.py:973–1013  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

971 return engine
972
973 def test_tokens(self):
974 m = MetaData()
975 sane_alone = Table("t", m, Column("id", Integer))
976 sane_schema = Table("t", m, Column("id", Integer), schema="s")
977 insane_alone = Table("t t", m, Column("id", Integer))
978 insane_schema = Table("t t", m, Column("id", Integer), schema="s s")
979 ddl = DDL("%(schema)s-%(table)s-%(fullname)s")
980 dialect = self.mock_engine().dialect
981 self.assert_compile(ddl.against(sane_alone), "-t-t", dialect=dialect)
982 self.assert_compile(
983 ddl.against(sane_schema), "s-t-s.t", dialect=dialect
984 )
985 self.assert_compile(
986 ddl.against(insane_alone), '-"t t"-"t t"', dialect=dialect
987 )
988 self.assert_compile(
989 ddl.against(insane_schema),
990 '"s s"-"t t"-"s s"."t t"',
991 dialect=dialect,
992 )
993
994 # overrides are used piece-meal and verbatim.
995
996 ddl = DDL(
997 "%(schema)s-%(table)s-%(fullname)s-%(bonus)s",
998 context={"schema": "S S", "table": "T T", "bonus": "b"},
999 )
1000 self.assert_compile(
1001 ddl.against(sane_alone), "S S-T T-t-b", dialect=dialect
1002 )
1003 self.assert_compile(
1004 ddl.against(sane_schema), "S S-T T-s.t-b", dialect=dialect
1005 )
1006 self.assert_compile(
1007 ddl.against(insane_alone), 'S S-T T-"t t"-b', dialect=dialect
1008 )
1009 self.assert_compile(
1010 ddl.against(insane_schema),
1011 'S S-T T-"s s"."t t"-b',
1012 dialect=dialect,
1013 )
1014
1015 def test_filter(self):
1016 cx = self.mock_engine()

Callers

nothing calls this directly

Calls 7

mock_engineMethod · 0.95
MetaDataClass · 0.90
TableClass · 0.90
ColumnClass · 0.90
DDLClass · 0.85
assert_compileMethod · 0.80
againstMethod · 0.45

Tested by

no test coverage detected