Skip to content

Collection: Dictionary Should Contain Item incorrectly casts values to strings before comparison #4408

Closed

Description

@pekkaklarck

Current Dictionary Should Contain Item converts both the expected and the actual value to string before comparison. For example, the following example passes:

*** Settings ***
Library          Collections

*** Variables ***
&{DICT}    a=${1}

*** Test Cases ***
Example
    Dictionary Should Contain Item    ${DICT}    a    1

This makes no sense in general and is also inconsistent with other keywords in Collections that don't do such casting.

Activity

  1. added this to the v5.1 milestone on Jul 14, 2022
  2. cloutierjo commented on Jul 12, 2023

    @cloutierjo

    It actually made total sense since type in robot are a pain to manage and everything is almost treated as a string.

    But then, let's accept the change, but please fix the keyword doc just 3 lines above that clearly state "Value is converted to unicode for comparison."
    I just lost half a day trying to understand why all of a sudden I had an integer!=string when it specifically say everything is compared as string!

  3. added theissue type on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions