Encode unchecked multi-value filters as repeated query parameters - #125
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
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.
Summary
Fixes #123.
Expand both lists and tuples into repeated array query parameters, adding
[]only when the stored key does not already end with it.Query.parametersstores unchecked iterable values as tuples under suffixed keys, but the URL builder previously recognized only lists. It therefore sent one Python tuple representation instead of the individual values.The change also honors tuple sequences passed to
VariableQuery.instance_format. The storedparamsrepresentation, dedicated-method argument unpacking, scalar encoding, options, and pagination are unchanged. This is separate from the coordinate-formatting and header-propagation work in other open PRs.Tests
Added 19 cases covering all five query classes, lists/tuples/iterators/sets, empty and singleton values, duplicates, numeric ranges, declared sequence arguments, and unchanged scalar/dedicated-method behavior. Tests of
results,get, andhitsuse actual Requests prepared requests, replacing onlySession.send. They verify repeated keys on both pagination requests and preserve the original query headers.testsdirectory after the fix: 148 passed, including the existing doctest collection, with 89% package statement coverage. Existing VCR fixtures were replayed withrecord_mode='none'to prohibit new recordings; no live CMR requests were made.mypy cmr tests: passed using the repository-locked mypy 1.11.2 and requests stubs.E9,F63,F7,F82) on the source and new tests: passed. The new test file also passes the broader Flake8 check with the repository's 127-character limit.git diff --check: passed.Tested on macOS with Python 3.12.11 against develop at
9f7648ccb925b9c0eb50241e35f15d6454e89505. Test replay uses VCR.py 8.3.0 with the locally resolved Requests/urllib3 versions; this is not a claim that the entire Poetry lockfile environment was recreated. No dependency/lockfile changes, live-service validation, or cross-platform/version matrix is included. Changelog and method documentation are updated.