Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Argument conversion with enums should work with normalized names #3611

Closed
@Snooz82

Description

@Snooz82

We are using a lot of enums in Browser Library and would like to have the automatic conversion from strings in RF to enum members in Python being able to match members based on a normalized string.

Because members of enums can not contains spaces, like method names in python, but spaces are typically quite common in RobotFramework we want to be able to allow spaces in member names.
Same with case sensitivity.
Case sensitivity with values is very rare.

Lets assume we have the following enum:

AssertionOperator = Enum(
    "AssertionOperator",
    {
        "noassertion": "NO_ASSERTION",
        "NO_ASSERTION": "NO_ASSERTION",
        "equal": "==",
        "==": "==",
        "shouldbe": "==",
        "inequal": "!=",
        "!=": "!=",
        "shouldnotbe": "!=",
        "lessthan": "<",
        "<": "<",
        "greaterthan": ">",
        ">": ">",
        "<=": "<=",
        ">=": ">=",
        "contains": "*=",
        "*=": "*=",
        "starts": "^=",
        "^=": "^=",
        "shouldstartwith": "^=",
        "ends": "$=",
        "shouldendwith": "$=",
        "$=": "$=",
        "matches": "$",
        "validate": "validate",
        "then": "then",
    },
)

The values in robot shouldnotbe, Should Not Be and should_not_be etc all match to the member shouldnotbe

When documenting the enum in libdoc it should also document the "robotic" name Should Not Be

This is related to #3607 but imho with a higher priority.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions