Append new query parameters after existing parameters - #197
Open
oyeong011 wants to merge 1 commit into
Open
Conversation
Existing parameter replacements retain their first position; new names no longer use a negative insertion index. Constraint: Preserve Python 2-compatible source style and both URL types Confidence: high Scope-risk: narrow Tested: 137 tests and doctests; actual URL and DecodedURL calls including 10000 query entries Not-tested: Historical Python interpreters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
URL.set()andDecodedURL.set()insert a previously absent query parameter before the final existing parameter because the fallback insertion index is-1. Use the end of the filtered query instead, while preserving the first position when replacing existing occurrences.The existing
test_set_orderingalready documented the expected append behavior in a TODO. The regression now checks it, plus both URL types, empty/single/multiple queries, duplicate replacement, and input immutability.Validation: 137 tests/doctests passed on Python 3.11; public API checks also passed with 10,000 query entries. Historical Python versions were not available.
AI disclosure: this patch and its tests were prepared with OpenAI Codex and verified by executing the tests and public APIs.