Skip to content

Fix recursive ignore_case=KEYS normalization - #5859

Merged
pekkaklarck merged 1 commit into
robotframework:masterfrom
wangqiao258:fix/5858-ignore-case-keys
Nov 18, 2026
Merged

pekkaklarck merged 1 commit into
robotframework:masterfrom
wangqiao258:fix/5858-ignore-case-keys

Conversation

@wangqiao258

Copy link
Copy Markdown
Contributor

Fixes #5858.

Problem

Dictionaries Should Be Equal documents ignore_case=KEYS as recursive, but nested dictionary keys kept their original case. With {A: {B: Value}} and {a: {b: Value}} the comparison failed with Key a: {'B': 'Value'} != {'b': 'Value'}, and the same happened when the nested dictionary was inside a list.

Root cause

Normalizer.__bool__ only checked the currently active ignore_case flag. While normalizing dictionary values in KEYS mode, ignore_case is temporarily False, so normalize() returned nested containers unchanged and their keys were never normalized.

Fix

Include ignore_key_case and ignore_value_case in Normalizer.__bool__, so recursion continues while either dimension is active. Per-level folding is still controlled by the temporary ignore_case value, so KEYS still ignores only keys and VALUES still ignores only values.

Tests

Two new acceptance cases:

  • nested dictionaries and dictionaries inside lists compare equal with ignore_case=KEYS
  • nested values are still case-sensitive with ignore_case=KEYS (negative test)

Validation

  • Fork CI (wangqiao258/robotframework#1): Unit tests and Acceptance tests pass on Ubuntu + Windows with Python 3.9 and 3.14
  • Target suite: 26/26 passed
  • All standard libraries acceptance: 2333/2333 passed
  • Collections + BuiltIn + String acceptance: 1329/1329 passed
  • Reproduced on a Linux VM against master 8e6a235: both nested cases fail before the patch and pass after it
  • invoke format and git diff --check pass

AI disclosure: prepared with AI assistance; I reviewed the change and ran the tests myself.

Normalizer.__bool__ only checked the currently active ignore_case flag. When ignore_case=KEYS normalized dictionary values, ignore_case was temporarily False, so nested containers were returned as-is and their keys were never normalized. Include ignore_key_case and ignore_value_case in the check and add acceptance tests for nested dictionaries and lists.

@pekkaklarck pekkaklarck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

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.

Collections: ignore_case=KEYS does not normalize nested dictionary keys

2 participants