Skip to content

Commit 9e17155

Browse files
committed
Update pilot.app.query_one call.
1 parent e0bbddd commit 9e17155

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

tests/tests_tui/test_tui_datatypes.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ async def test_select_displayed_datatypes_create(
5050

5151
for datatype in narrow_datatype_names:
5252
assert (
53-
pilot.app.query_one(f"#create_{datatype}_checkbox").value
53+
pilot.app.screen.query_one(
54+
f"#create_{datatype}_checkbox"
55+
).value
5456
is False
5557
)
5658

@@ -96,7 +98,9 @@ async def test_select_displayed_datatypes_create(
9698
for datatype in broad_datatype_names:
9799
# check all are shown and False again (because False on reset)
98100
assert (
99-
pilot.app.query_one(f"#create_{datatype}_checkbox").value
101+
pilot.app.screen.query_one(
102+
f"#create_{datatype}_checkbox"
103+
).value
100104
is False
101105
)
102106

@@ -116,13 +120,15 @@ async def test_select_displayed_datatypes_create(
116120
for datatype in broad_datatype_names:
117121
# check all are shown and False again
118122
assert (
119-
pilot.app.query_one(f"#create_{datatype}_checkbox").value
123+
pilot.app.screen.query_one(
124+
f"#create_{datatype}_checkbox"
125+
).value
120126
is False
121127
)
122128

123129
# Confirm also that narrow datatypes are not shown.
124130
with pytest.raises(BaseException):
125-
pilot.app.query_one(
131+
pilot.app.screen.query_one(
126132
f"#create_{narrow_datatype_names[0]}_checkbox"
127133
)
128134

@@ -165,7 +171,9 @@ async def test_select_displayed_datatypes_transfer(
165171

166172
for datatype in narrow_datatype_names:
167173
assert (
168-
pilot.app.query_one(f"#transfer_{datatype}_checkbox").value
174+
pilot.app.screen.query_one(
175+
f"#transfer_{datatype}_checkbox"
176+
).value
169177
is False
170178
)
171179

tests/tests_tui/test_tui_validate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ async def test_validate_on_project_manager_output(
5858

5959
written_lines = [
6060
ele.text
61-
for ele in pilot.app.query_one("#validate_richlog").lines
61+
for ele in pilot.app.screen.query_one(
62+
"#validate_richlog"
63+
).lines
6264
]
6365

6466
assert len(written_lines) == 3
@@ -157,7 +159,7 @@ async def test_validate_on_project_manager_kwargs(
157159
"validate_path_container",
158160
]:
159161
with pytest.raises(textual.css.query.InvalidQueryFormat):
160-
pilot.app.query_one(id)
162+
pilot.app.screen.query_one(id)
161163

162164
@pytest.mark.asyncio
163165
async def test_validate_at_path_kwargs(self, setup_project_paths, mocker):
@@ -198,4 +200,4 @@ async def test_validate_at_path_kwargs(self, setup_project_paths, mocker):
198200

199201
# Check removed widgets, this should be removed because always local
200202
with pytest.raises(textual.css.query.InvalidQueryFormat):
201-
pilot.app.query_one("validate_include_central_checkbox")
203+
pilot.app.screen.query_one("validate_include_central_checkbox")

0 commit comments

Comments
 (0)