Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2010 Tim Diels <limyreth@users.sourceforge.net> 2 # 3 # This file is part of pytilities. 4 # 5 # pytilities is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # pytilities is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with pytilities. If not, see <http://www.gnu.org/licenses/>. 17 # 18 19 __docformat__ = 'reStructuredText' 20 21 import unittest 22 23 from .. import Dispatcher, RestrictedDispatcher, UnsupportedEventError 24 from .helpers import Listener 2550 5328 self.l = Listener() 29 30 d = Dispatcher() 31 d.register_events("a", "b") 32 self.ed = RestrictedDispatcher(d, allow="b")3335 self.assertFalse(self.ed.has_event("a")) 36 self.assertRaises(UnsupportedEventError, self.ed.add_handler, "a", 37 self.l.handle_noarg) 38 self.assertRaises(UnsupportedEventError, self.ed.remove_handler, "a", 39 self.l.handle_noarg) 40 self.assertRaises(UnsupportedEventError, self.ed.dispatch, "a")4143 self.assert_(self.ed.has_event("b")) 44 45 self.ed.add_handler("b", self.l.handle_noarg) 46 self.ed.dispatch("b") 47 48 #has handler b 49 self.assertEquals(self.l.last, "noarg")
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Mon Jul 19 11:49:30 2010 | http://epydoc.sourceforge.net |