示例#1
0
 def test_scoped_session_unique(self):
     session = mock.Mock()
     scoped = ScopedEventHandler(session, 'eventname', 'handler', 'unique')
     with scoped:
         session.register.assert_called_with('eventname', 'handler',
                                             'unique')
     session.unregister.assert_called_with('eventname', 'handler', 'unique')
示例#2
0
 def test_scoped_event_handler(self):
     event_emitter = mock.Mock()
     scoped = ScopedEventHandler(event_emitter, 'eventname', 'handler')
     with scoped:
         event_emitter.register.assert_called_with('eventname', 'handler',
                                                   None)
     event_emitter.unregister.assert_called_with('eventname', 'handler',
                                                 None)