MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_has_table_case_sensitive

Method test_has_table_case_sensitive

test/sql/test_quote.py:70–117  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

68
69 @testing.provide_metadata
70 def test_has_table_case_sensitive(self, connection):
71 preparer = testing.db.dialect.identifier_preparer
72 conn = connection
73 if conn.dialect.requires_name_normalize:
74 conn.exec_driver_sql("CREATE TABLE TAB1 (id INTEGER)")
75 else:
76 conn.exec_driver_sql("CREATE TABLE tab1 (id INTEGER)")
77 conn.exec_driver_sql(
78 "CREATE TABLE %s (id INTEGER)" % preparer.quote_identifier("tab2")
79 )
80 conn.exec_driver_sql(
81 "CREATE TABLE %s (id INTEGER)" % preparer.quote_identifier("TAB3")
82 )
83 conn.exec_driver_sql(
84 "CREATE TABLE %s (id INTEGER)" % preparer.quote_identifier("TAB4")
85 )
86
87 t1 = Table(
88 "tab1", self.metadata, Column("id", Integer, primary_key=True)
89 )
90 t2 = Table(
91 "tab2",
92 self.metadata,
93 Column("id", Integer, primary_key=True),
94 quote=True,
95 )
96 t3 = Table(
97 "TAB3", self.metadata, Column("id", Integer, primary_key=True)
98 )
99 t4 = Table(
100 "TAB4",
101 self.metadata,
102 Column("id", Integer, primary_key=True),
103 quote=True,
104 )
105
106 insp = inspect(connection)
107 assert insp.has_table(t1.name)
108 eq_([c["name"] for c in insp.get_columns(t1.name)], ["id"])
109
110 assert insp.has_table(t2.name)
111 eq_([c["name"] for c in insp.get_columns(t2.name)], ["id"])
112
113 assert insp.has_table(t3.name)
114 eq_([c["name"] for c in insp.get_columns(t3.name)], ["id"])
115
116 assert insp.has_table(t4.name)
117 eq_([c["name"] for c in insp.get_columns(t4.name)], ["id"])
118
119 def test_basic(self, connection):
120 table1, table2 = self.tables("WorstCase1", "WorstCase2")

Callers

nothing calls this directly

Calls 8

TableClass · 0.90
ColumnClass · 0.90
inspectFunction · 0.90
eq_Function · 0.90
quote_identifierMethod · 0.80
exec_driver_sqlMethod · 0.45
has_tableMethod · 0.45
get_columnsMethod · 0.45

Tested by

no test coverage detected