Refactor tests to extract get_actions_links() helper

pull/2295/head
Simon Willison 2024-03-06 16:39:29 -08:00
rodzic 3bc7281936
commit fd837d243e
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -943,7 +943,16 @@ def get_actions_links(html):
details = soup.find("details", {"class": "actions-menu-links"})
if details is None:
return []
return [{"label": a.text.strip(), "href": a["href"]} for a in details.select("a")]
return [
{
"label": a.text.strip(),
"href": a["href"],
"description": (
a.find("p").text.strip() if a.find("p") is not None else None
),
}
for a in details.select("a")
]
@pytest.mark.asyncio