Skip to content

Variable type conversion in arguments (#3278) #3354

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

Conversation

LeConTesteur
Copy link
Contributor

Hi,
This PR implements a part of functionnality of issues #3278

I implement only type conversion for arguments of keyword.
I reuse same tests of python function annotations, except for the vargs and the kwargs. Moreover, i remove tests for decorators.
Don't hesitate to challenge the name of class or method, the english is not my best language.

Best Regards,

@pekkaklarck
Copy link
Member

First of all, thanks for the PR! This is pretty big task to implement and I've been thinking it's too big for the already overdue RF 3.2, but including it is still possible if we can get this PR into a good enough shape. I won't have time for a full review until I have got RF 3.2 alpha 1 ready, but below are some general comments about this PR after a very quick look:

  1. This PR only adds support for argument conversion. Conversion in the Variables section and also when assigning variables based on keyword return values are needed as well. Probably a good idea to get this first feature ready first.

  2. I don't think we need to support syntax like ${arg: 'int'}. Just supporting ${arg: int} (space being optional) ought to be enough. I also don't see reasons why to support Python's typing style usages like ${arg:Mapping[str, int]} either. Just supporting same string names and aliases that work with the dynamic library API (Support automatic argument conversion with dynamic libraries #2068) ought to be enough.

  3. Implementation looks pretty complicated. Most probably that's due to the support for formats like ${arg:Mapping[str, int]}. I think this could be done pretty easily in argumentparser.py: PythonArgumentParser already does it with Python based keywords and UserKeywordArgumentParser could probably do it with user keywords.

@LeConTesteur
Copy link
Contributor Author

Hi,
If we don't need the typing style usages, the code will be simplied.
I will rework my code with your comments.

@LeConTesteur
Copy link
Contributor Author

I removed typing style usages, abc types, enum and bytesstring type. The other types is already convertible by TypeConverter.
Too I put my implementation in argumentparser.py and I removed typingresolver.py.

@LeConTesteur
Copy link
Contributor Author

I am closing this PR because i will propose new implementation for the issue #3278 who work with variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants