Example #1
0
    def test_publish_on_disabled_event(self):
        event = Event('disabled')
        event.disable()

        # noinspection PyShadowingNames
        @event.subscribe()
        async def funny_handler(message, publisher, event):
            return [message, publisher, event]

        with Loop(event.publish('sad message')) as loop:
            result = loop.run_until_complete()

        self.assertIsNone(result)
Example #2
0
    def test_disable(self):
        event = Event('Disable manually')
        self.assertTrue(event.is_enable)

        event.disable()
        self.assertFalse(event.is_enable)