File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,39 @@ def test_validate():
4545 node .toggle_class ("1" )
4646
4747
48+ def test_inherited_bindings ():
49+ """Test if binding merging is done correctly when (not) inheriting bindings."""
50+ class A (DOMNode ):
51+ BINDINGS = [("a" , "a" , "a" )]
52+
53+ class B (A ):
54+ BINDINGS = [("b" , "b" , "b" )]
55+
56+ class C (B , inherit_bindings = False ):
57+ BINDINGS = [("c" , "c" , "c" )]
58+
59+ class D (C , inherit_bindings = False ):
60+ pass
61+
62+ class E (D ):
63+ BINDINGS = [("e" , "e" , "e" )]
64+
65+ a = A ()
66+ assert list (a ._bindings .keys .keys ()) == ["a" ]
67+
68+ b = B ()
69+ assert list (b ._bindings .keys .keys ()) == ["a" , "b" ]
70+
71+ c = C ()
72+ assert list (c ._bindings .keys .keys ()) == ["c" ]
73+
74+ d = D ()
75+ assert not list (d ._bindings .keys .keys ())
76+
77+ e = E ()
78+ assert list (e ._bindings .keys .keys ()) == ["e" ]
79+
80+
4881@pytest .fixture
4982def search ():
5083 """
You can’t perform that action at this time.
0 commit comments