Skip to content

Commit 7f3839f

Browse files
committed
address review feedback: merge path/Path doc types, drop redundant tests
1 parent 64dc283 commit 7f3839f

3 files changed

Lines changed: 1 addition & 75 deletions

File tree

scripts/documentation_provider.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,11 @@ def inner_serialize_doc_type(self, type: Any, direction: str) -> str:
474474
return f"Union[{', '.join(ll)}]"
475475

476476
type_name = type["name"]
477-
if type_name == "path":
477+
if type_name in ("path", "Path"):
478478
if direction == "in":
479479
return "Union[pathlib.Path, str]"
480480
else:
481481
return "pathlib.Path"
482-
if type_name == "Path":
483-
return "pathlib.Path"
484482

485483
if type_name == "function" and "args" not in type:
486484
return "Callable"

tests/async/test_locators.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,21 +1294,6 @@ async def test_drop_should_drop_files_and_data_together(page: Page) -> None:
12941294
assert info["data"]["text/plain"] == "label"
12951295

12961296

1297-
async def test_highlight_should_attach_a_glass_pane(page: Page) -> None:
1298-
# Ported from upstream tests/page/locator-highlight.spec.ts. The Python
1299-
# SDK uses a closed shadow root for the highlight overlay, so we can only
1300-
# observe the host element x-pw-glass from outside the shadow. We verify
1301-
# that highlight() and hide_highlight() invoke without error and that
1302-
# multiple highlights stack on the page.
1303-
await page.set_content("<button>One</button><button>Two</button>")
1304-
await page.get_by_role("button", name="One").highlight()
1305-
await page.get_by_role("button", name="Two").highlight()
1306-
await expect(page.locator("x-pw-glass")).to_have_count(1)
1307-
# hide_highlight per-locator and page-level should not raise.
1308-
await page.get_by_role("button", name="One").hide_highlight()
1309-
await page.hide_highlight()
1310-
1311-
13121297
async def test_get_by_role_with_description(page: Page) -> None:
13131298
# Ported from upstream tests/page/selectors-get-by.spec.ts.
13141299
await page.set_content(
@@ -1363,40 +1348,6 @@ async def texts(locator: Locator) -> list:
13631348
) == ["Alert 1", "Alert 2"]
13641349

13651350

1366-
async def test_get_by_role_with_description_via_aria_describedby(page: Page) -> None:
1367-
# Ported from upstream tests/page/selectors-get-by.spec.ts.
1368-
await page.set_content(
1369-
"""
1370-
<button aria-describedby="desc1">Submit</button>
1371-
<span id="desc1">Submits the form data</span>
1372-
<button aria-describedby="desc2">Submit</button>
1373-
<span id="desc2">Saves as draft</span>
1374-
"""
1375-
)
1376-
assert await page.get_by_role(
1377-
"button", name="Submit", description="form data"
1378-
).evaluate_all("els => els.map(e => e.textContent)") == ["Submit"]
1379-
assert await page.get_by_role(
1380-
"button", name="Submit", description="draft"
1381-
).evaluate_all("els => els.map(e => e.textContent)") == ["Submit"]
1382-
1383-
1384-
async def test_get_by_role_with_description_via_title_fallback(page: Page) -> None:
1385-
# Ported from upstream tests/page/selectors-get-by.spec.ts.
1386-
await page.set_content(
1387-
"""
1388-
<button title="Submits the form">Submit</button>
1389-
<button title="Resets the form">Reset</button>
1390-
"""
1391-
)
1392-
assert await page.get_by_role("button", description="Submits").evaluate_all(
1393-
"els => els.map(e => e.textContent)"
1394-
) == ["Submit"]
1395-
assert await page.get_by_role("button", description="Resets").evaluate_all(
1396-
"els => els.map(e => e.textContent)"
1397-
) == ["Reset"]
1398-
1399-
14001351
async def test_get_by_role_with_description_whitespace_normalization(
14011352
page: Page,
14021353
) -> None:

tests/sync/test_locators.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,15 +1065,6 @@ def test_drop_should_drop_clipboard_like_data(page: Page) -> None:
10651065
assert info["data"]["text/plain"] == "hello world"
10661066

10671067

1068-
def test_highlight_should_attach_a_glass_pane(page: Page) -> None:
1069-
page.set_content("<button>One</button><button>Two</button>")
1070-
page.get_by_role("button", name="One").highlight()
1071-
page.get_by_role("button", name="Two").highlight()
1072-
expect(page.locator("x-pw-glass")).to_have_count(1)
1073-
page.get_by_role("button", name="One").hide_highlight()
1074-
page.hide_highlight()
1075-
1076-
10771068
def test_get_by_role_with_description(page: Page) -> None:
10781069
page.set_content(
10791070
"""
@@ -1107,20 +1098,6 @@ def texts(locator: Locator) -> list:
11071098
) == ["Alert 1", "Alert 2"]
11081099

11091100

1110-
def test_get_by_role_with_description_via_aria_describedby(page: Page) -> None:
1111-
page.set_content(
1112-
"""
1113-
<button aria-describedby="desc1">Submit</button>
1114-
<span id="desc1">Submits the form data</span>
1115-
<button aria-describedby="desc2">Submit</button>
1116-
<span id="desc2">Saves as draft</span>
1117-
"""
1118-
)
1119-
assert page.get_by_role(
1120-
"button", name="Submit", description="form data"
1121-
).evaluate_all("els => els.map(e => e.textContent)") == ["Submit"]
1122-
1123-
11241101
def test_get_by_role_with_description_whitespace_normalization(page: Page) -> None:
11251102
page.set_content(
11261103
'<div role="alert" aria-description="File doc-2025.pdf was uploaded successfully">Alert</div>'

0 commit comments

Comments
 (0)