/tests/core/test_filters.py
https://bitbucket.org/prologic/circuits/ · Python · 29 lines · 18 code · 9 blank · 2 comment · 3 complexity · 43e221327836289b2cc775439038a4a1 MD5 · raw file
- #!/usr/bin/env python
- from circuits import handler, Event, BaseComponent
- class test(Event):
- """test Event"""
- class App(BaseComponent):
- @handler("test")
- def _on_test(self, event):
- try:
- return "Hello World!"
- finally:
- event.stop()
- def _on_test2(self):
- pass # Never reached
- def test_main():
- app = App()
- while app:
- app.flush()
- x = app.fire(test())
- app.flush()
- assert x.value == "Hello World!"