Fix BeautifulSoup deprecation warnings in tests

Fixes findNext → find_next and nextSibling → next_sibling

Refs 9becb04e
This commit is contained in:
Simon Willison 2025-11-05 09:49:10 -08:00
commit f626983fdb
2 changed files with 2 additions and 2 deletions

View file

@ -333,7 +333,7 @@ def test_row_links_from_other_tables(app_client, path, expected_text, expected_l
soup = Soup(response.body, "html.parser") soup = Soup(response.body, "html.parser")
h2 = soup.find("h2") h2 = soup.find("h2")
assert h2.text == "Links from other tables" assert h2.text == "Links from other tables"
li = h2.findNext("ul").find("li") li = h2.find_next("ul").find("li")
text = re.sub(r"\s+", " ", li.text.strip()) text = re.sub(r"\s+", " ", li.text.strip())
assert text == expected_text assert text == expected_text
link = li.find("a")["href"] link = li.find("a")["href"]

View file

@ -1032,7 +1032,7 @@ def test_column_metadata(app_client):
response = app_client.get("/fixtures/roadside_attractions") response = app_client.get("/fixtures/roadside_attractions")
soup = Soup(response.body, "html.parser") soup = Soup(response.body, "html.parser")
dl = soup.find("dl") dl = soup.find("dl")
assert [(dt.text, dt.nextSibling.text) for dt in dl.find_all("dt")] == [ assert [(dt.text, dt.next_sibling.text) for dt in dl.find_all("dt")] == [
("name", "The name of the attraction"), ("name", "The name of the attraction"),
("address", "The street address for the attraction"), ("address", "The street address for the attraction"),
] ]