mass renaming

This commit is contained in:
Will McGugan
2023-02-13 15:09:40 +00:00
parent e75024ef58
commit 6b5015b266
12 changed files with 85 additions and 87 deletions

View File

@@ -13,28 +13,28 @@ async def test_remove_single_widget():
assert not widget.is_attached
await pilot.app.mount(widget)
assert widget.is_attached
assert len(pilot.app.screen.children) == 1
assert len(pilot.app.screen._nodes) == 1
await pilot.app.query_one(Static).remove()
assert not widget.is_attached
assert len(pilot.app.screen.children) == 0
assert len(pilot.app.screen._nodes) == 0
async def test_many_remove_all_widgets():
"""It should be possible to remove all widgets on a multi-widget screen."""
async with App().run_test() as pilot:
await pilot.app.mount(*[Static() for _ in range(10)])
assert len(pilot.app.screen.children) == 10
assert len(pilot.app.screen._nodes) == 10
await pilot.app.query(Static).remove()
assert len(pilot.app.screen.children) == 0
assert len(pilot.app.screen._nodes) == 0
async def test_many_remove_some_widgets():
"""It should be possible to remove some widgets on a multi-widget screen."""
async with App().run_test() as pilot:
await pilot.app.mount(*[Static(classes=f"is-{n%2}") for n in range(10)])
assert len(pilot.app.screen.children) == 10
assert len(pilot.app.screen._nodes) == 10
await pilot.app.query(".is-0").remove()
assert len(pilot.app.screen.children) == 5
assert len(pilot.app.screen._nodes) == 5
async def test_remove_branch():
@@ -46,7 +46,7 @@ async def test_remove_branch():
Container(Container(Container(Container(Container(Static()))))),
)
assert len(pilot.app.screen.walk_children(with_self=False)) == 13
await pilot.app.screen.children[0].remove()
await pilot.app.screen._nodes[0].remove()
assert len(pilot.app.screen.walk_children(with_self=False)) == 7
@@ -68,14 +68,14 @@ async def test_remove_move_focus():
async with App().run_test() as pilot:
buttons = [Button(str(n)) for n in range(10)]
await pilot.app.mount(Container(*buttons[:5]), Container(*buttons[5:]))
assert len(pilot.app.screen.children) == 2
assert len(pilot.app.screen._nodes) == 2
assert len(pilot.app.screen.walk_children(with_self=False)) == 12
assert pilot.app.focused is None
await pilot.press("tab")
assert pilot.app.focused is not None
assert pilot.app.focused == buttons[0]
await pilot.app.screen.children[0].remove()
assert len(pilot.app.screen.children) == 1
await pilot.app.screen._nodes[0].remove()
assert len(pilot.app.screen._nodes) == 1
assert len(pilot.app.screen.walk_children(with_self=False)) == 6
assert pilot.app.focused is not None
assert pilot.app.focused == buttons[9]
@@ -95,7 +95,7 @@ async def test_widget_remove_order():
Removable(Removable(Removable(id="grandchild"), id="child"), id="parent")
)
assert len(pilot.app.screen.walk_children(with_self=False)) == 3
await pilot.app.screen.children[0].remove()
await pilot.app.screen._nodes[0].remove()
assert len(pilot.app.screen.walk_children(with_self=False)) == 0
assert removals == ["grandchild", "child", "parent"]