MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_chained_events_one

Method test_chained_events_one

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

Source from the content-addressed store, hash-verified

732 sess.execute(insert(User), orig_params)
733
734 def test_chained_events_one(self):
735 sess = Session(testing.db, future=True)
736
737 @event.listens_for(sess, "do_orm_execute")
738 def one(ctx):
739 ctx.update_execution_options(one=True)
740
741 @event.listens_for(sess, "do_orm_execute")
742 def two(ctx):
743 ctx.update_execution_options(two=True)
744
745 @event.listens_for(sess, "do_orm_execute")
746 def three(ctx):
747 ctx.update_execution_options(three=True)
748
749 @event.listens_for(sess, "do_orm_execute")
750 def four(ctx):
751 ctx.update_execution_options(four=True)
752
753 result = sess.execute(select(literal_column("1")))
754
755 eq_(
756 result.context.execution_options,
757 {
758 "four": True,
759 "one": True,
760 "three": True,
761 "two": True,
762 },
763 )
764
765 def _flag_fixture(self, session):
766 canary = Mock()

Callers

nothing calls this directly

Calls 5

executeMethod · 0.95
SessionClass · 0.90
selectFunction · 0.90
literal_columnFunction · 0.90
eq_Function · 0.90

Tested by

no test coverage detected