/tests/core/test_all_channels.py

https://bitbucket.org/prologic/circuits/ · Python · 40 lines · 22 code · 11 blank · 7 comment · 1 complexity · 5600bc56df276ce666f76d9635c6a0f0 MD5 · raw file

  1. # Module: test_all_channels
  2. # Date: 23rd February 2010
  3. # Author: James Mills, prologic at shortcircuit dot net dot au
  4. """All Channels Tests
  5. Test that events can be sent to all channels.
  6. """
  7. from circuits import Event, Component, Manager
  8. class Base(Component):
  9. def __init__(self, *args, **kwargs):
  10. super(Base, self).__init__(*args, **kwargs)
  11. self.flag = False
  12. def foo(self, event, *args, **kwargs):
  13. self.flag = True
  14. def test():
  15. m = Manager()
  16. a = Base(channel="a")
  17. b = Base(channel="b")
  18. c = Base()
  19. a.register(m)
  20. b.register(m)
  21. c.register(m)
  22. while m:
  23. m.flush()
  24. m.fire(Event(), "*")
  25. m.flush()
  26. assert not a.flag
  27. assert not b.flag
  28. assert c.flag