MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_lazyload_flags

Method test_lazyload_flags

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected