Add test coverage for parse_qsl/parse_qs strict_parsing on malformed query fields
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
urllib.parse.parse_qsl() and parse_qs() accept a strict_parsing keyword that, when True, raises ValueError on a malformed query field — one without a = separator, e.g. "a=1&b&c=3". This error branch is currently not exercised by Lib/test/test_urlparse.py: the existing parse_qsl/parse_qs tests only cover well-formed inputs and the default lenient behavior, so a regression that silently dropped the strict_parsing check would not be caught. It would be good to add a small test covering the strict_parsing=True branch for both functions on str and bytes inputs, alongside a well-formed control. Addressed by PR #154207.
Linked PRs
- gh-154207
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Lib/test/test_urlparse.py by reviewing the existing parse_qsl and parse_qs tests, including their str and bytes cases. Confirm that PR #154207 addresses strict_parsing=True for malformed and well-formed query fields, and use the relevant urlparse test suite to verify the coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100