MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_slots_dispatch

Method test_slots_dispatch

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

Source from the content-addressed store, hash-verified

339 event.listen(t1, "event_one", Mock())
340
341 def test_slots_dispatch(self):
342 class Target:
343 __slots__ = ("_slots_dispatch",)
344
345 class TargetEvents(event.Events):
346 _dispatch_target = Target
347
348 def event_one(self, x, y):
349 pass
350
351 def event_two(self, x):
352 pass
353
354 def event_three(self, x):
355 pass
356
357 t1 = Target()
358
359 m1 = Mock()
360 event.listen(t1, "event_one", m1)
361
362 t1.dispatch.event_one(2, 4)
363
364 eq_(m1.mock_calls, [call(2, 4)])
365
366
367class NamedCallTest(TearDownLocalEventsFixture, fixtures.TestBase):

Callers

nothing calls this directly

Calls 5

eq_Function · 0.90
callFunction · 0.85
TargetClass · 0.70
listenMethod · 0.45
event_oneMethod · 0.45

Tested by

no test coverage detected