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 diff --git a/tests/test_getters.py b/tests/test_getters.py index 4ccfbf85e1..f92173e94c 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): @@ -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():