PageRenderTime 31ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/core/test_filter_order.py

https://bitbucket.org/prologic/circuits/
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. """Filter Order Tests
  5. Test that Event Handlers set as Filters are added and sorted
  6. such that Filters preceed non-filters.
  7. """
  8. from circuits import handler, Component
  9. class App(Component):
  10. def test(self, event, *args, **kwargs):
  11. pass
  12. @handler("test", filter=True)
  13. def on_test(self, event, *args, **kwargs):
  14. pass
  15. def test():
  16. app = App()
  17. handlers = app.channels.get(("*", "test"), [])
  18. assert handlers and handlers[0] == app.on_test