You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Collections: ignore_case=KEYS does not normalize nested dictionary keys #5858
With Robot Framework 7.5.2.dev1 at master commit 8e6a235 (Python 3.13.5, Windows 11 10.0.26200), Collections does not apply ignore_case=KEYS to dictionaries nested inside a dictionary value. The same problem occurs when the nested dictionary is inside a list.
Expected: the dictionaries compare equal because only key capitalization differs, including the nested key. Recursive key/value handling is documented and was explicitly discussed in #4343 (#4343 (comment)).
Observed:
Following keys have different values:
Key a: {'B': 'Value'} != {'b': 'Value'}
Using {"A": [{"B": "Value"}]} and {"a": [{"b": "Value"}]} fails in the same way. Both cases also fail through the real Robot acceptance-test runner. As a diagnostic clue, adding an unrelated ignore_keys=["unused"] makes the first example pass on the same unchanged source.
Investigation
normalize_value() temporarily sets self.ignore_case to false in KEYS mode. Then normalize() returns early because Normalizer.__bool__() uses that temporary flag, so it never reaches the nested dictionary.
A fix needs to preserve the existing container semantics as well as enabling recursion. Simply forcing traversal can expose the sequence reconstruction fallback: namedtuple values or range(2) must not become equal to a plain list, and VALUES mode must preserve hashable namedtuple keys. I have not submitted the experimental patch because it changes those comparisons. The original defect and these counterexamples are reproducible; the intended behavior remains recursive key normalization while keeping values case-sensitive.
AI assistance was used for investigation and local verification.
Thanks for the report @anticipate218. The problem that the KEYS mode is not recursive is easy to fix and PR #5859 by @wangqiao258 does that nicely.
Can you clarify your concerns about container types changing? We try to preserve types (see the _try_to_preserve_type method), but that won't work in all cases. If you have ideas how to enhance the situation, we certainly can do something to it. That should get its own issue, though.
PR #5859 looks so good that I'll merge it now anyway. I assigned this issue to RF 7.6, but if we still release RF 7.5.2 this will be already part of it.
Thanks for fixing the recursive KEYS case. I verified that it now works at 429888e.
I filed the requested separate container-normalization report at #5861. It includes before/after examples where VALUES turns namedtuple/range keys into unhashable lists, and KEYS makes those values compare equal to plain lists. I reproduced both changes with the Collections API and the Robot runner.
AI assistance was used for the investigation and this reply.
Activity
pekkaklarck commentedon Nov 18, 2026
Thanks for the report @anticipate218. The problem that the KEYS mode is not recursive is easy to fix and PR #5859 by @wangqiao258 does that nicely.
Can you clarify your concerns about container types changing? We try to preserve types (see the
_try_to_preserve_typemethod), but that won't work in all cases. If you have ideas how to enhance the situation, we certainly can do something to it. That should get its own issue, though.PR #5859 looks so good that I'll merge it now anyway. I assigned this issue to RF 7.6, but if we still release RF 7.5.2 this will be already part of it.
anticipate218 commentedon Nov 18, 2026
Thanks for fixing the recursive KEYS case. I verified that it now works at 429888e.
I filed the requested separate container-normalization report at #5861. It includes before/after examples where VALUES turns namedtuple/range keys into unhashable lists, and KEYS makes those values compare equal to plain lists. I reproduced both changes with the Collections API and the Robot runner.
AI assistance was used for the investigation and this reply.
Collections: Fix recursive `ignore_case=KEYS` normalization (robotfra…