Show More
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | from backcall import callback_prototype |
|
2 | 2 | import unittest |
|
3 | 3 | from unittest.mock import Mock |
|
4 | import nose.tools as nt | |
|
4 | 5 | |
|
5 | 6 | from IPython.core import events |
|
6 | 7 | import IPython.testing.tools as tt |
@@ -31,6 +32,17 b' class CallbackTests(unittest.TestCase):' | |||
|
31 | 32 | self.em.trigger('ping_received') |
|
32 | 33 | self.assertEqual(cb.call_count, 1) |
|
33 | 34 | |
|
35 | def test_bare_function_missed_unregister(self): | |
|
36 | def cb1(): | |
|
37 | ... | |
|
38 | ||
|
39 | def cb2(): | |
|
40 | ... | |
|
41 | ||
|
42 | self.em.register('ping_received', cb1) | |
|
43 | nt.assert_raises(ValueError, self.em.unregister, 'ping_received', cb2) | |
|
44 | self.em.unregister('ping_received', cb1) | |
|
45 | ||
|
34 | 46 | def test_cb_error(self): |
|
35 | 47 | cb = Mock(side_effect=ValueError) |
|
36 | 48 | self.em.register('ping_received', cb) |
General Comments 0
You need to be logged in to leave comments.
Login now