From 2826aff76e011e92f13bd3a49ee2f055f3e424f0 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:32:41 +0100 Subject: [PATCH 1/3] test(getters): ensure pytest actually runs the test --- tests/test_getters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_getters.py b/tests/test_getters.py index 4ccfbf85e1..173206fd3a 100644 --- a/tests/test_getters.py +++ b/tests/test_getters.py @@ -7,7 +7,7 @@ from textual.widgets import Input, Label -async def get_getters() -> None: +async def test_getters() -> None: """Check the getter descriptors work, and return expected errors.""" class QueryApp(App): From ca91185e8f5d32ecdf7f395f029463487ce536af Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:36:52 +0100 Subject: [PATCH 2/3] test(getters): fix invalid class names in test --- tests/test_getters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_getters.py b/tests/test_getters.py index 173206fd3a..f92173e94c 100644 --- a/tests/test_getters.py +++ b/tests/test_getters.py @@ -20,8 +20,8 @@ class QueryApp(App): def compose(self) -> ComposeResult: with containers.Vertical(): - yield Label(id="label1", classes=".red") - yield Label(id="label2", classes=".green") + yield Label(id="label1", classes="red") + yield Label(id="label2", classes="green") app = QueryApp() async with app.run_test(): From 12e6bf0e214b7e2040a66d062a0a57b807fe6320 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Wed, 9 Jul 2025 18:09:04 +0100 Subject: [PATCH 3/3] fix(getters): fix id in error messages --- src/textual/getters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/textual/getters.py b/src/textual/getters.py index f5b23590b0..6cb54caf31 100644 --- a/src/textual/getters.py +++ b/src/textual/getters.py @@ -178,11 +178,11 @@ def __get__( return self child = obj._nodes._get_by_id(self.child_id) if child is None: - raise NoMatches(f"No child found with id={id!r}") + raise NoMatches(f"No child found with id={self.child_id!r}") if not isinstance(child, self.expect_type): if not isinstance(child, self.expect_type): raise WrongType( - f"Child with id={id!r} is wrong type; expected {self.expect_type}, got" + f"Child with id={self.child_id!r} is wrong type; expected {self.expect_type}, got" f" {type(child)}" ) return child