MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_propagate

Method test_propagate

test/base/test_events.py:1588–1614  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1586 eq_(canary.mock_calls, assert_calls)
1587
1588 def test_propagate(self):
1589 Target = self._fixture()
1590
1591 m1 = Mock()
1592
1593 t1 = Target()
1594 t2 = Target()
1595
1596 event.listen(t1, "event_one", m1, propagate=True)
1597 event.listen(t1, "event_two", m1, propagate=False)
1598
1599 t2.dispatch._update(t1.dispatch)
1600
1601 t1.dispatch.event_one("t1e1x")
1602 t1.dispatch.event_two("t1e2x")
1603 t2.dispatch.event_one("t2e1x")
1604 t2.dispatch.event_two("t2e2x")
1605
1606 event.remove(t1, "event_one", m1)
1607 event.remove(t1, "event_two", m1)
1608
1609 t1.dispatch.event_one("t1e1y")
1610 t1.dispatch.event_two("t1e2y")
1611 t2.dispatch.event_one("t2e1y")
1612 t2.dispatch.event_two("t2e2y")
1613
1614 eq_(m1.mock_calls, [call("t1e1x"), call("t1e2x"), call("t2e1x")])
1615
1616 @testing.requires.predictable_gc
1617 def test_listener_collection_removed_cleanup(self):

Callers

nothing calls this directly

Calls 9

_fixtureMethod · 0.95
eq_Function · 0.90
callFunction · 0.85
TargetClass · 0.70
listenMethod · 0.45
_updateMethod · 0.45
event_oneMethod · 0.45
event_twoMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected