33import pytest
44
55from textual .app import App
6- from textual .binding import Binding , BindingError , InvalidBinding , NoBinding , _Bindings
6+ from textual .binding import (
7+ Binding ,
8+ BindingError ,
9+ BindingsMap ,
10+ InvalidBinding ,
11+ NoBinding ,
12+ )
713
814BINDING1 = Binding ("a,b" , action = "action1" , description = "description1" )
915BINDING2 = Binding ("c" , action = "action2" , description = "description2" )
1218
1319@pytest .fixture
1420def bindings ():
15- yield _Bindings ([BINDING1 , BINDING2 ])
21+ yield BindingsMap ([BINDING1 , BINDING2 ])
1622
1723
1824@pytest .fixture
1925def more_bindings ():
20- yield _Bindings ([BINDING1 , BINDING2 , BINDING3 ])
26+ yield BindingsMap ([BINDING1 , BINDING2 , BINDING3 ])
2127
2228
2329def test_bindings_get_key (bindings ):
@@ -34,38 +40,40 @@ def test_bindings_get_key_spaced_list(more_bindings):
3440
3541
3642def test_bindings_merge_simple (bindings ):
37- left = _Bindings ([BINDING1 ])
38- right = _Bindings ([BINDING2 ])
39- assert _Bindings .merge ([left , right ]).keys == bindings .keys
43+ left = BindingsMap ([BINDING1 ])
44+ right = BindingsMap ([BINDING2 ])
45+ assert BindingsMap .merge ([left , right ]).keys == bindings .keys
4046
4147
4248def test_bindings_merge_overlap ():
43- left = _Bindings ([BINDING1 ])
49+ left = BindingsMap ([BINDING1 ])
4450 another_binding = Binding (
4551 "a" , action = "another_action" , description = "another_description"
4652 )
47- assert _Bindings .merge ([left , _Bindings ([another_binding ])]).keys == {
53+ assert BindingsMap .merge ([left , BindingsMap ([another_binding ])]).keys == {
4854 "a" : another_binding ,
4955 "b" : Binding ("b" , action = "action1" , description = "description1" ),
5056 }
5157
5258
5359def test_bad_binding_tuple ():
5460 with pytest .raises (BindingError ):
55- _ = _Bindings ((("a" ,),))
61+ _ = BindingsMap ((("a" ,),))
5662 with pytest .raises (BindingError ):
57- _ = _Bindings ((("a" , "action" , "description" , "too much" ),))
63+ _ = BindingsMap ((("a" , "action" , "description" , "too much" ),))
5864
5965
6066def test_binding_from_tuples ():
6167 assert (
62- _Bindings (((BINDING2 .key , BINDING2 .action , BINDING2 .description ),)).get_key ("c" )
68+ BindingsMap (((BINDING2 .key , BINDING2 .action , BINDING2 .description ),)).get_key (
69+ "c"
70+ )
6371 == BINDING2
6472 )
6573
6674
6775def test_shown ():
68- bindings = _Bindings (
76+ bindings = BindingsMap (
6977 [
7078 Binding (
7179 key ,
0 commit comments