MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_m2o_noload_option

Method test_m2o_noload_option

test/orm/test_deprecations.py:2268–2291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2266 )
2267
2268 def test_m2o_noload_option(self):
2269 Address, addresses, users, User = (
2270 self.classes.Address,
2271 self.tables.addresses,
2272 self.tables.users,
2273 self.classes.User,
2274 )
2275 self.mapper_registry.map_imperatively(
2276 Address, addresses, properties={"user": relationship(User)}
2277 )
2278 self.mapper_registry.map_imperatively(User, users)
2279 s = fixture_session()
2280 with expect_noload_deprecation():
2281 a1 = (
2282 s.query(Address)
2283 .filter_by(id=1)
2284 .options(sa.orm.noload(Address.user))
2285 .first()
2286 )
2287
2288 def go():
2289 eq_(a1.user, None)
2290
2291 self.sql_count_(0, go)
2292
2293
2294class DynamicTest(_DynamicFixture, _fixtures.FixtureTest):

Callers

nothing calls this directly

Calls 10

relationshipFunction · 0.90
fixture_sessionFunction · 0.90
map_imperativelyMethod · 0.80
noloadMethod · 0.80
sql_count_Method · 0.80
firstMethod · 0.45
optionsMethod · 0.45
filter_byMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected