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

Method test_ambiguous_column

test/sql/test_resultset.py:1181–1205  ·  view source on GitHub ↗
(self, connection, scenario)

Source from the content-addressed store, hash-verified

1179 "scenario", ["plain", "pickled", "frozen", "frozen_pickled"]
1180 )
1181 def test_ambiguous_column(self, connection, scenario):
1182 users = self.tables.users
1183 addresses = self.tables.addresses
1184
1185 connection.execute(users.insert(), dict(user_id=1, user_name="john"))
1186 result = connection.execute(
1187 users.outerjoin(addresses)
1188 .select()
1189 .set_label_style(LABEL_STYLE_NONE)
1190 )
1191
1192 if scenario.frozen or scenario.frozen_pickled:
1193 frozen = result.freeze()
1194 result = frozen()
1195
1196 r = result.first()
1197
1198 if scenario.pickled or scenario.frozen_pickled:
1199 r = pickle.loads(pickle.dumps(r))
1200
1201 assert_raises_message(
1202 exc.InvalidRequestError,
1203 "Ambiguous column name",
1204 lambda: r._mapping["user_id"],
1205 )
1206
1207 @testing.requires.duplicate_names_in_cursor_description
1208 def test_ambiguous_column_getter(self, connection):

Callers

nothing calls this directly

Calls 10

assert_raises_messageFunction · 0.90
executeMethod · 0.45
insertMethod · 0.45
set_label_styleMethod · 0.45
selectMethod · 0.45
outerjoinMethod · 0.45
freezeMethod · 0.45
firstMethod · 0.45
loadsMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected