fix: replace the CNN exercise with EZ population#2295
fix: replace the CNN exercise with EZ population#2295honzajavorek wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
| for country_link in euro_countries_accordion.select("li a"): | ||
| country_url = urljoin(listing_url, country_link["href"]) | ||
| country_soup = download(country_url) | ||
| total_population += parse_population(country_soup) |
There was a problem hiding this comment.
Python crashes when parse_population returns None
High Severity
parse_population is typed int | None and returns None when no li element contains "Population". The line total_population += parse_population(country_soup) will raise a TypeError if None is returned, since int + None is invalid in Python. The JavaScript version correctly handles this by filtering out non-integer values with .filter((population) => Number.isInteger(population)) before summing, but the Python version has no equivalent guard.
Additional Locations (1)
There was a problem hiding this comment.
The exercise is naive to keep the code simple, so yeah, it relies on the target website a lot and it would crash, but the code is tested, so we'd know. Anyway, I'll add one line to make you happy.
|
Preview for this PR was built for commit |
|
Preview for this PR was built for commit |


Fix #2183
Note
Low Risk
Documentation/exercise content update plus new sample scripts; main risk is brittleness due to reliance on a third-party website structure and live network calls in tests.
Overview
Updates the JavaScript and Python “scraping variants” lessons to replace the CNN Sports shortest-article exercise with a new eurozone population exercise.
Removes the old CNN solution scripts and adds new
eurozone_populationimplementations (Node/Cheerio and Python/httpx+BeautifulSoup) that crawl the EU euro-area country pages, extractPopulation, and print the summed total; corresponding bats tests are updated to run the new scripts and assert a plausible numeric result.Written by Cursor Bugbot for commit 28be7a5. Configure here.