MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_none

Method test_set_none

test/orm/test_backref_mutations.py:182–198  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

180 assert a1 in u2.addresses
181
182 def test_set_none(self):
183 User, Address = self.classes.User, self.classes.Address
184
185 sess = fixture_session()
186 u1 = User(name="jack")
187 a1 = Address(email_address="a1")
188 a1.user = u1
189 sess.add_all([u1, a1])
190 sess.commit()
191
192 # works for None too
193 def go():
194 a1.user = None
195
196 self.assert_sql_count(testing.db, go, 0)
197
198 assert a1 not in u1.addresses
199
200 def test_scalar_move_notloaded(self):
201 User, Address = self.classes.User, self.classes.Address

Callers

nothing calls this directly

Calls 6

fixture_sessionFunction · 0.90
assert_sql_countMethod · 0.80
UserClass · 0.70
AddressClass · 0.70
add_allMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected