-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Support for "extended assign" like ${var.attr} = Some Keyword
#1059
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
I agree this would be handy and find it surprising nobody has requested this earlier. Because I got a feeling this would be pretty immediately useful at least in one project at NSN and implementing this is pretty straightforward, I try to get this into 2.7. I actually already prototyped this and a simple patch that makes the the original example pass is attached. There are some open issues to be discussed before this can be fully implemented:
|
I'm going to implement this so that open questions above are resolved like this:
|
This issue was updated by revision d778a2bf312f. Implementation is pretty much done. |
This issue was updated by revision ba573f0359f2. Decided to disable extended assign altogether if the base variable is string or integer. Assigning attributes to these immutable objects wouldn't work anyway and now this feature is less backwards-incompatible. For example, following example that does not use extended assign but instead uses the dot to create a logical namespace will continue to work: ${url} = Set Variable http://my.app |
This issue was updated by revision f529ad7b0301. Refactored related code a little. |
This issue was updated by revision 898f9860d5e2. Righter rules for using the new syntax. Mainly to avoid potential backwards-incompatibility problems. |
This issue was updated by revision 77b7d8d8a29b. Now this feature is also documented in the User Guide. Janne, could you review the code, tests, and docs? |
This issue was updated by revision 09851621bb24. One more refactoring: Better home for new VariableAssigner. |
Reviewed, looks good. |
Uh oh!
There was an error while loading. Please reload this page.
Attempting to assign a property of a Python object using the extended variable syntax counter-intuitively creates a new test variable with the same name as the extended variable.
Robot Framework 2.6.3 (Python 2.7.2 on win32)
Test suite:
vars.py:
The text was updated successfully, but these errors were encountered: