예제 #1
0
    def test_trigger(self):
        event = Event()
        result = {}

        @event.connect
        def test1(data):
            result['x'] = data

        event.trigger({1: 2})

        self.assertDictEqual(result, {'x': {1: 2}})
예제 #2
0
    def test_multiple_triggers(self):
        event = Event()
        result = {}

        @event.connect
        def test1(data):
            result['x'] = data

        @event.connect
        def test2(a):
            result['y'] = a

        event.trigger({1: 2})

        self.assertDictEqual(result, {'x': {1: 2}, 'y': {1: 2}})