MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_ignores_user

Method test_ignores_user

test/orm/test_cascade.py:1109–1135  ·  view source on GitHub ↗
(self, fixture, lazy)

Source from the content-addressed store, hash-verified

1107
1108 @testing.combinations(("select",), ("raise",), argnames="lazy")
1109 def test_ignores_user(self, fixture, lazy):
1110 A, B = fixture()
1111
1112 sess = fixture_session()
1113
1114 a1 = A(email="x")
1115 b1 = B(user=a1)
1116 sess.add_all([a1, b1])
1117 sess.commit()
1118
1119 b1 = sess.execute(select(B)).scalars().first()
1120
1121 sess.delete(b1)
1122
1123 self.assert_sql_execution(
1124 testing.db,
1125 sess.flush,
1126 # we would like it to be able to skip this SELECT but this is not
1127 # implemented right now
1128 CompiledSQL(
1129 "SELECT a.id, a.email FROM a " "WHERE a.email = :param_1",
1130 [{"param_1": "x"}],
1131 ),
1132 CompiledSQL(
1133 "DELETE FROM b WHERE b.id = :id", lambda ctx: [{"id": 1}]
1134 ),
1135 )
1136
1137
1138class NoSaveCascadeFlushTest(_fixtures.FixtureTest):

Callers

nothing calls this directly

Calls 13

fixture_sessionFunction · 0.90
selectFunction · 0.90
CompiledSQLClass · 0.90
assert_sql_executionMethod · 0.80
AClass · 0.70
BClass · 0.70
fixtureFunction · 0.50
add_allMethod · 0.45
commitMethod · 0.45
firstMethod · 0.45
scalarsMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected