MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_no_slots_dispatch

Method test_no_slots_dispatch

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

Source from the content-addressed store, hash-verified

314
315class SlotsEventsTest(fixtures.TestBase):
316 def test_no_slots_dispatch(self):
317 class Target:
318 __slots__ = ()
319
320 class TargetEvents(event.Events):
321 _dispatch_target = Target
322
323 def event_one(self, x, y):
324 pass
325
326 def event_two(self, x):
327 pass
328
329 def event_three(self, x):
330 pass
331
332 t1 = Target()
333
334 with testing.expect_raises_message(
335 TypeError,
336 r"target .*Target.* doesn't have __dict__, should it "
337 "be defining _slots_dispatch",
338 ):
339 event.listen(t1, "event_one", Mock())
340
341 def test_slots_dispatch(self):
342 class Target:

Callers

nothing calls this directly

Calls 2

TargetClass · 0.70
listenMethod · 0.45

Tested by

no test coverage detected