-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Argument conversion with enums should work with normalized names #3611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Enum member matching being case, space and also underscore insensitive like matching keyword names sounds good to me. It also ought to be so easy to do and backwards compatible that we can consider it in RF 3.2.2. How Libdoc should show enum members is a different question and part of #3607. |
This will actually be somewhat backwards incompatible as currently there could be lower and uppercase etc enum values that are different. They will be same after this change. |
Yeah, it's possible someone would be affected by this change but those changes are pretty small compared to benefits. The bigger question is, do we want to have such an enhancement in a patch release in the first place. A library using this functionality would then work differently with RF 3.2.1 and 3.2.2 which needed to be documented. Then again, there's the same issue between RF 3.2 and 3.3 if we do the change later. I still think this is a good enhancement for RF 3.2.2 but if others disagree and this feature isn't needed super urgently waiting for RF 3.3 is fine as well. |
Thanks to @willemvanoort for PR #3632 implementing this! |
This enhancement ought to be fully backwards compatible. The reason is that the code first tries an exact match so if we have an enum like class Example(Enum):
FOO = 1
foo = 2 using If an enum has two members with names that have same normalized form, using a non-exact version will actually be an error. For example, using argument |
It is now an error to use non-exact match that matches multiple members. See issue robotframework#3611 and PR robotframework#3632 for more details.
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:
The values in robot
shouldnotbe
,Should Not Be
andshould_not_be
etc all match to the membershouldnotbe
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.
The text was updated successfully, but these errors were encountered: