Ejemplo n.º 1
0
 def __init__(self, bot):
     self.bot = bot
     # One time events that we only need to register temporarily
     self.before_connect_events = [
         event.event(event.NOTICE, callback=self.check_login),
         event.event(event.RPL_ENDOFMOTD, callback=self.remove_events),
         event.event(event.GLOBALUSERSTATE, callback=self.set_user_state)
     ]
Ejemplo n.º 2
0
 def test___init__(self):
     func = lambda x: x
     instance = event.event('ABC', callback=func)
     assert instance.callback == func
Ejemplo n.º 3
0
 def test_compile_no_config(self):
     func = lambda x: x
     decorated = event.event(r'\S+')(func)
     matcher = decorated.compile()
     assert matcher('ABC') is not None
     assert matcher('ABC ') is None
Ejemplo n.º 4
0
 def test_raw_event(self):
     func = lambda x: x
     decorated = event.event(event.PRIVMSG)(func)
     assert decorated.key == event.PRIVMSG.re
Ejemplo n.º 5
0
 def test_regexp(self):
     func = lambda x: x
     decorated = event.event('ABC')(func)
     assert decorated.regexp == 'ABC'
Ejemplo n.º 6
0
 def test_decorator(self):
     func = lambda x: x
     instance = event.event('ABC')
     assert instance.callback is None
     decorated = instance(func)
     assert decorated.callback == func