Skip to content

Add test coverage for parse_qsl/parse_qs strict_parsing on malformed query fields #154317

Description

@nikolauspschuetz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions