MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_alembic_quote

Method test_alembic_quote

test/sql/test_quote.py:913–939  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

911 a_eq(unformat("`foo`.`b``a``r`.`baz`"), ["foo", "b`a`r", "baz"])
912
913 def test_alembic_quote(self):
914 t1 = Table(
915 "TableOne", MetaData(), Column("MyCol", Integer, index=True)
916 )
917 t2 = Table(
918 "some_table", MetaData(), Column("some_col", Integer, index=True)
919 )
920 t3 = Table(
921 "some_table", MetaData(), Column("some_col", Integer, index=True)
922 )
923 ix3 = Index("my_index", t3.c.some_col)
924 ix4 = Index("MyIndex", t3.c.some_col)
925 ix5 = Index(None, t3.c.some_col)
926
927 for idx, expected in [
928 (list(t1.indexes)[0], "ix_TableOne_MyCol"),
929 (list(t2.indexes)[0], "ix_some_table_some_col"),
930 (ix3, "my_index"),
931 (ix4, "MyIndex"),
932 (ix5, "ix_some_table_some_col"),
933 ]:
934 eq_(
935 testing.db.dialect.identifier_preparer.format_constraint(
936 idx, _alembic_quote=False
937 ),
938 expected,
939 )
940
941
942class QuotedIdentTest(fixtures.TestBase):

Callers

nothing calls this directly

Calls 6

TableClass · 0.90
MetaDataClass · 0.90
ColumnClass · 0.90
IndexClass · 0.90
eq_Function · 0.90
format_constraintMethod · 0.80

Tested by

no test coverage detected