/tests/core/test_filter_order.py
Python | 26 lines | 11 code | 7 blank | 8 comment | 1 complexity | 64f93be6a8d8c05b11a1bf366a465e1f MD5 | raw file
1# Module: test_filter_order 2# Date: 23rd February 2010 3# Author: James Mills, prologic at shortcircuit dot net dot au 4 5"""Filter Order Tests 6 7Test that Event Handlers set as Filters are added and sorted 8such that Filters preceed non-filters. 9""" 10 11from circuits import handler, Component 12 13 14class App(Component): 15 16 def test(self, event, *args, **kwargs): 17 pass 18 19 @handler("test", filter=True) 20 def on_test(self, event, *args, **kwargs): 21 pass 22 23def test(): 24 app = App() 25 handlers = app.channels.get(("*", "test"), []) 26 assert handlers and handlers[0] == app.on_test