Exemplo n.º 1
0
def test_known_property_multiple_inheritance():
    class Behavior:
        def __init__(self, name):
            print(f'Behavior: {self}, name={name}')
            super().__init__()

    class Widget2(Behavior, EventDispatcher):
        pass

    class Widget3(EventDispatcher, Behavior):
        pass

    with pytest.raises(TypeError) as cm:
        EventDispatcher(name='Pasta')
    assert "Properties ['name'] passed to __init__ may not be existing" \
           in str(cm.value)

    Widget2(name='Pasta')  # does not raise a ValueError
    Widget3(name='Pasta')  # does not raise a ValueError
Exemplo n.º 2
0
 def create_handler(self, window):
     import kivy
     from kivy.event import EventDispatcher
     handler = EventDispatcher()
     return handler