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

Method test_tokens

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

Source from the content-addressed store, hash-verified

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