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
Currently we don't any argument conversion if an argument has string as its type like arg: str. The main reason is that at the moment we only convert the given argument if its type is a string, but the plan is to change that #3735. Implementing this change would avoid problems like robotframework/SeleniumLibrary#1021.
The only design decision related to this is what argument types to convert. All Python objects have a string representation, so if you have a keyword like
defkeyword(arg: str):
print(arg, type(arg))
and call it like
Keyword ${NONE}
and we convert all arguments, the keyword gets string None as an argument. Other options would be making this situation with None an error and passing None as-is without conversion. I got a feeling it's best to just convert all arguments, including None.
If we convert everything, including ´None`, it means that if we'd have keyword
defkeyword(arg: str=None):
print(arg, type(arg))
and call it like above, the keyword would still get string None as the argument. I guess that's OK because the argument has an explicit str type even though it has None as the default value.
This will be implemented so that all arguments are converted the type is given explicitly using annotation (e.g. arg: str) or decorator (e.g. @keyword(types={'arg': str}). If the type if got from the default value (e.g. `arg='foo'), conversion is not done.
Activity
pekkaklarck commentedon Oct 25, 2020
This will be implemented so that all arguments are converted the type is given explicitly using annotation (e.g.
arg: str) or decorator (e.g.@keyword(types={'arg': str}). If the type if got from the default value (e.g. `arg='foo'), conversion is not done.Type conversion to string #3736
UG: Document argument conversion changes.
Type conversion to string robotframework#3736
UG: Document argument conversion changes.