diff --git a/CHANGELOG.md b/CHANGELOG.md index d3e1b7eae..2b9b196dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Changed the `Checkbox` character due to issues with Windows Terminal and Windows 10 https://github.com/Textualize/textual/issues/1934 - Changed the `RadioButton` character due to issues with Windows Terminal and Windows 10 and 11 https://github.com/Textualize/textual/issues/1934 - Changed the `Markdown` initial bullet character due to issues with Windows Terminal and Windows 10 and 11 https://github.com/Textualize/textual/issues/1982 +- The underscore `_` is no longer a special alias for the method `pilot.press` ### Added diff --git a/src/textual/app.py b/src/textual/app.py index 70c18f2e6..5283e2076 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -862,9 +862,7 @@ class App(Generic[ReturnType], DOMNode): assert driver is not None await wait_for_idle(0) for key in keys: - if key == "_": - continue - elif key.startswith("wait:"): + if key.startswith("wait:"): _, wait_ms = key.split(":") print(f"(pause {wait_ms}ms)") await asyncio.sleep(float(wait_ms) / 1000) diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index 0b26c83c9..d3196ae48 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -1,4 +1,3 @@ -from os import terminal_size from pathlib import Path import pytest @@ -73,8 +72,7 @@ def test_input_and_focus(snap_compare): "tab", *"Darren", # Focus first input, write "Darren" "tab", - *"Burns", - "_", # Tab focus to second input, write "Burns" + *"Burns", # Focus second input, write "Burns" ] assert snap_compare(WIDGET_EXAMPLES_DIR / "input.py", press=press) @@ -91,17 +89,17 @@ def test_placeholder_render(snap_compare): def test_datatable_render(snap_compare): - press = ["tab", "down", "down", "right", "up", "left", "_"] + press = ["tab", "down", "down", "right", "up", "left"] assert snap_compare(WIDGET_EXAMPLES_DIR / "data_table.py", press=press) def test_datatable_row_cursor_render(snap_compare): - press = ["up", "left", "right", "down", "down", "_"] + press = ["up", "left", "right", "down", "down"] assert snap_compare(SNAPSHOT_APPS_DIR / "data_table_row_cursor.py", press=press) def test_datatable_column_cursor_render(snap_compare): - press = ["left", "up", "down", "right", "right", "_"] + press = ["left", "up", "down", "right", "right"] assert snap_compare(SNAPSHOT_APPS_DIR / "data_table_column_cursor.py", press=press) diff --git a/tests/test_pilot.py b/tests/test_pilot.py index 2ca527895..04491dea9 100644 --- a/tests/test_pilot.py +++ b/tests/test_pilot.py @@ -3,10 +3,8 @@ from string import punctuation from textual import events from textual.app import App -KEY_CHARACTERS_TO_TEST = "akTW03" + punctuation.replace("_", "") -"""Test some "simple" characters (letters + digits) and all punctuation. -Ignore the underscore because that is an alias to add a pause in the pilot. -""" +KEY_CHARACTERS_TO_TEST = "akTW03" + punctuation +"""Test some "simple" characters (letters + digits) and all punctuation.""" async def test_pilot_press_ascii_chars():