MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_is_modified_passive_off

Method test_is_modified_passive_off

test/orm/test_session.py:2351–2377  ·  view source on GitHub ↗

as of 0.8 no SQL is emitted for is_modified() regardless of the passive flag

(self)

Source from the content-addressed store, hash-verified

2349 assert not s.is_modified(user, include_collections=False)
2350
2351 def test_is_modified_passive_off(self):
2352 """as of 0.8 no SQL is emitted for is_modified()
2353 regardless of the passive flag"""
2354
2355 User, Address = self._default_mapping_fixture()
2356
2357 s = fixture_session()
2358 u = User(name="fred", addresses=[Address(email_address="foo")])
2359 s.add(u)
2360 s.commit()
2361
2362 u.id
2363
2364 def go():
2365 assert not s.is_modified(u)
2366
2367 self.assert_sql_count(testing.db, go, 0)
2368
2369 s.expire_all()
2370 u.name = "newname"
2371
2372 # can't predict result here
2373 # deterministically, depending on if
2374 # 'name' or 'addresses' is tested first
2375 mod = s.is_modified(u)
2376 addresses_loaded = "addresses" in u.__dict__
2377 assert mod is not addresses_loaded
2378
2379 def test_is_modified_syn(self):
2380 User, users = self.classes.User, self.tables.users

Callers

nothing calls this directly

Calls 9

fixture_sessionFunction · 0.90
assert_sql_countMethod · 0.80
UserClass · 0.70
AddressClass · 0.70
addMethod · 0.45
commitMethod · 0.45
expire_allMethod · 0.45
is_modifiedMethod · 0.45

Tested by

no test coverage detected