-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66f2e0c
commit f7a1f5a
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import ListView, ListItem, Label | ||
|
||
|
||
class ListViewApp(App[None]): | ||
def compose(self) -> ComposeResult: | ||
yield ListView( | ||
ListItem(Label("0")), | ||
ListItem(Label("1")), | ||
ListItem(Label("2")), | ||
ListItem(Label("3")), | ||
ListItem(Label("4")), | ||
ListItem(Label("5")), | ||
ListItem(Label("6")), | ||
ListItem(Label("7")), | ||
ListItem(Label("8")), | ||
) | ||
|
||
|
||
async def test_listview_remove_items() -> None: | ||
"""Regression test for https://github.com/Textualize/textual/issues/4735""" | ||
app = ListViewApp() | ||
async with app.run_test() as pilot: | ||
listview = pilot.app.query_one(ListView) | ||
assert len(listview) == 9 | ||
await listview.remove_items(range(4, 9)) | ||
assert len(listview) == 4 | ||
|
||
|
||
if __name__ == "__main__": | ||
app = ListViewApp() | ||
app.run() |