mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add a test for the shown_keys property
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from string import ascii_lowercase
|
||||
|
||||
import pytest
|
||||
|
||||
from textual.binding import Bindings, Binding, BindingError, NoBinding
|
||||
@@ -38,3 +40,11 @@ def test_bad_binding_tuple():
|
||||
|
||||
def test_binding_from_tuples():
|
||||
assert Bindings((( BINDING2.key, BINDING2.action, BINDING2.description),)).get_key("c") == BINDING2
|
||||
|
||||
def test_shown():
|
||||
bindings = Bindings([
|
||||
Binding(
|
||||
key, action=f"action_{key}", description=f"Emits {key}",show=bool(ord(key)%2)
|
||||
) for key in ascii_lowercase
|
||||
])
|
||||
assert len(bindings.shown_keys)==(len(ascii_lowercase)/2)
|
||||
|
||||
Reference in New Issue
Block a user