#!/usr/bin/env python

import pytest

from circuits import handler, Event, Component

class Test(Event):
    """Test Event"""

class Base(Component):

    def test(self):
        return "Hello World!"

class App1(Base):

    def test(self):
        return "Foobar"

class App2(Base):

    @handler("test", override=True)
    def test(self):
        return "Foobar"

def test_inheritence():
    app = App1()
    app.start()

    x = app.fire(Test())
    assert pytest.wait_for(x, "result")
    v = x.value
    assert v == ["Hello World!", "Foobar"]

    app.stop()

def test_override():
    app = App2()
    app.start()

    x = app.fire(Test())
    assert pytest.wait_for(x, "result")
    v = x.value
    assert v == "Foobar"

    app.stop()

@@ -210,24 +210,58 @@
 pp1(Base):%0A%0A
+    @handler(%22test%22, priority=-1)%0A
     def test

set handler priority in heritance to make sure we get the results in the right harder