Show More
@@ -89,9 +89,8 b' class EventManager(object):' | |||||
89 | available_events = {} |
|
89 | available_events = {} | |
90 |
|
90 | |||
91 | def _define_event(callback_function): |
|
91 | def _define_event(callback_function): | |
92 | callback_proto = callback_prototype(callback_function) |
|
92 | available_events[callback_function.__name__] = callback_function | |
93 | available_events[callback_function.__name__] = callback_proto |
|
93 | return callback_function | |
94 | return callback_proto |
|
|||
95 |
|
94 | |||
96 | # ------------------------------------------------------------------------------ |
|
95 | # ------------------------------------------------------------------------------ | |
97 | # Callback prototypes |
|
96 | # Callback prototypes |
@@ -76,16 +76,3 b' class CallbackTests(unittest.TestCase):' | |||||
76 | self.em.trigger('ping_received') |
|
76 | self.em.trigger('ping_received') | |
77 | self.assertEqual([True, True, False], invoked) |
|
77 | self.assertEqual([True, True, False], invoked) | |
78 | self.assertEqual([func3], self.em.callbacks['ping_received']) |
|
78 | self.assertEqual([func3], self.em.callbacks['ping_received']) | |
79 |
|
||||
80 | def test_ignore_event_arguments_if_no_argument_required(self): |
|
|||
81 | call_count = [0] |
|
|||
82 | def event_with_no_argument(): |
|
|||
83 | call_count[0] += 1 |
|
|||
84 |
|
||||
85 | self.em.register('event_with_argument', event_with_no_argument) |
|
|||
86 | self.em.trigger('event_with_argument', 'the argument') |
|
|||
87 | self.assertEqual(call_count[0], 1) |
|
|||
88 |
|
||||
89 | self.em.unregister('event_with_argument', event_with_no_argument) |
|
|||
90 | self.em.trigger('ping_received') |
|
|||
91 | self.assertEqual(call_count[0], 1) |
|
General Comments 0
You need to be logged in to leave comments.
Login now