| 314 | |
| 315 | class 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: |