experimental app getter

This commit is contained in:
Will McGugan
2025-08-31 11:38:12 +01:00
parent dcc495ab42
commit 995c2b7e6d
4 changed files with 97 additions and 23 deletions

View File

@@ -43,3 +43,19 @@ async def test_getters() -> None:
with pytest.raises(NoMatches):
app.label2_missing
async def test_app_getter() -> None:
class MyApp(App):
def compose(self) -> ComposeResult:
my_widget = MyWidget()
my_widget.app
yield my_widget
class MyWidget(Widget):
app = getters.app(MyApp)
app = MyApp()
async with app.run_test():
assert isinstance(app.query_one(MyWidget).app, MyApp)