Files
textual/tests/select/test_initial_value.py
Dave Pearson 91c3b4a513 Add a test for Select.value being set from the constructor
As an illustration for
https://github.com/Textualize/textual/discussions/3037 and having written it
it makes sense to drop it into the tests. As it is, it looks like Select has
no tests so this is a handy kickstart.
2023-07-31 15:00:31 +01:00

17 lines
494 B
Python

"""Initially https://github.com/Textualize/textual/discussions/3037"""
from textual.app import App, ComposeResult
from textual.widgets import Select
class SelectApp(App[None]):
INITIAL_VALUE = 3
def compose(self) -> ComposeResult:
yield Select[int]([(str(n), n) for n in range(10)], value=self.INITIAL_VALUE)
async def test_select_initial_value():
async with SelectApp().run_test() as pilot:
assert pilot.app.query_one(Select).value == SelectApp.INITIAL_VALUE