as of 0.8 no SQL is emitted for is_modified() regardless of the passive flag
(self)
| 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 |
nothing calls this directly
no test coverage detected