MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_selectinload_flags

Method test_selectinload_flags

test/orm/test_events.py:1000–1043  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

998 )
999
1000 def test_selectinload_flags(self):
1001 User, Address = self.classes("User", "Address")
1002
1003 sess = Session(testing.db, future=True)
1004
1005 canary = self._flag_fixture(sess)
1006
1007 u1 = sess.execute(
1008 select(User).filter_by(id=7).options(selectinload(User.addresses))
1009 ).scalar_one()
1010
1011 assert "addresses" in u1.__dict__
1012
1013 eq_(
1014 canary.mock_calls,
1015 [
1016 call.options(
1017 bind_mapper=inspect(User),
1018 all_mappers=[inspect(User)],
1019 is_select=True,
1020 is_from_statement=False,
1021 is_insert=False,
1022 is_update=False,
1023 is_delete=False,
1024 is_orm_statement=True,
1025 is_relationship_load=False,
1026 is_column_load=False,
1027 lazy_loaded_from=None,
1028 ),
1029 call.options(
1030 bind_mapper=inspect(Address),
1031 all_mappers=[inspect(Address)],
1032 is_select=True,
1033 is_from_statement=False,
1034 is_insert=False,
1035 is_update=False,
1036 is_delete=False,
1037 is_orm_statement=True,
1038 is_relationship_load=True,
1039 is_column_load=False,
1040 lazy_loaded_from=None,
1041 ),
1042 ],
1043 )
1044
1045 def test_subqueryload_flags(self):
1046 User, Address = self.classes("User", "Address")

Callers

nothing calls this directly

Calls 10

_flag_fixtureMethod · 0.95
executeMethod · 0.95
SessionClass · 0.90
selectFunction · 0.90
selectinloadFunction · 0.90
eq_Function · 0.90
inspectFunction · 0.90
scalar_oneMethod · 0.45
optionsMethod · 0.45
filter_byMethod · 0.45

Tested by

no test coverage detected