Пример #1
0
    def test_disconnect(self):
        event = Event()

        @event.connect
        def test1():
            pass

        event.disconnect(test1)
        self.assertSetEqual(event.receivers, set())
Пример #2
0
    def test_disconnect_invalid(self):
        event = Event()

        @event.connect
        def test1():
            pass

        def test2(a, b, c):
            pass

        event.disconnect(test2)
        self.assertSetEqual(event.receivers, {test1})