Skip to content

Make removal of missing query options idempotent - #130

Open
r4venrudy wants to merge 1 commit into
nasa:developfrom
r4venrudy:fix/idempotent-option-removal
Open

r4venrudy wants to merge 1 commit into
nasa:developfrom
r4venrudy:fix/idempotent-option-removal

Conversation

@r4venrudy

@r4venrudy r4venrudy commented Oct 11, 2026 •

Copy link
Copy Markdown

Removing an option that was never set, or removing the same option twice, currently raises KeyError. The method documents removal when an option was previously given and should remain chainable.

Use a non-inserting lookup and pop(..., None) so missing removals are harmless and unrelated options are preserved. Add five test cases for absent keys/parameters, repeated removal, chaining, and empty names. Three of these cases fail on the original implementation.

Validation on Windows x64 / Python 3.12:

  • Full suite: 135 passed, using the recorded VCR fixtures with outbound socket connections blocked.
  • mypy cmr tests: passed (1.11.2).
  • CI's fatal-error flake8 selection: passed.
  • Wheel build: passed.

The test environment used the repository lockfile's requests 2.32.4, urllib3 2.2.3, and vcrpy 6.0.1 versions; no dependency or fixture changes are included.

Avoid KeyError for absent or already removed options and cover missing,
repeated, and empty-name removals with regression tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant