Skip to content

Keep key comparisons and ordering operations case insensitive - #99

Open
ShahadatTest wants to merge 1 commit into
xolox:masterfrom
ShahadatTest:fix/case-insensitive-key-protocols
Open

ShahadatTest wants to merge 1 commit into
xolox:masterfrom
ShahadatTest:fix/case-insensitive-key-protocols

Conversation

@ShahadatTest

Copy link
Copy Markdown

CaseInsensitiveKey("A") == "a" and CaseInsensitiveKey("A") != "a" are currently both true. CaseInsensitiveDict.move_to_end() also bypasses key coercion, so moving an existing key using another case raises KeyError.

Define inequality from the existing equality comparison (preserving NotImplemented), and coerce keys for the inherited ordering operation. Tests cover operand direction, unsupported types, both ordering directions, non-string keys and missing keys.

Validation: both new tests fail before the change. Python 3.12: 65 passed, with the same six pre-existing Windows failures as an independently rerun baseline (63 passed). Four case tests pass on Python 3.10. Flake8 passes with existing D211/D400 findings excluded; git diff --check passes. The existing pop/update errors covered by #96 are outside this change.

AI assistance: OpenAI Codex (GPT-6). Original user request: new 14ta koro aro (make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.

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