MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_selectinload_flags

Method test_selectinload_flags

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

Source from the content-addressed store, hash-verified

1049 )
1050
1051 def test_selectinload_flags(self):
1052 User, Address = self.classes("User", "Address")
1053
1054 sess = Session(testing.db, future=True)
1055
1056 canary = self._flag_fixture(sess)
1057
1058 u1 = sess.execute(
1059 select(User).filter_by(id=7).options(selectinload(User.addresses))
1060 ).scalar_one()
1061
1062 assert "addresses" in u1.__dict__
1063
1064 eq_(
1065 canary.mock_calls,
1066 [
1067 call.options(
1068 bind_mapper=inspect(User),
1069 all_mappers=[inspect(User)],
1070 is_select=True,
1071 is_from_statement=False,
1072 is_insert=False,
1073 is_update=False,
1074 is_delete=False,
1075 is_orm_statement=True,
1076 is_relationship_load=False,
1077 is_column_load=False,
1078 lazy_loaded_from=None,
1079 ),
1080 call.options(
1081 bind_mapper=inspect(Address),
1082 all_mappers=[inspect(Address)],
1083 is_select=True,
1084 is_from_statement=False,
1085 is_insert=False,
1086 is_update=False,
1087 is_delete=False,
1088 is_orm_statement=True,
1089 is_relationship_load=True,
1090 is_column_load=False,
1091 lazy_loaded_from=None,
1092 ),
1093 ],
1094 )
1095
1096 def test_subqueryload_flags(self):
1097 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