-
Notifications
You must be signed in to change notification settings - Fork 62
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
NOV-244340: expression for selecting in an array for a context storage #388
NOV-244340: expression for selecting in an array for a context storage #388
Conversation
for idx, item in enumerate(the_list): | ||
if key in item and item[key] == value: | ||
return the_list[idx] | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return
statements within this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sr codeclimate, puedo quitar algún que otro return en esta función, si le parece, y reemplazarlo con if elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif if elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif if elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif
Sr codeclimate, puedo meter la función que indica como compleja con if elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif elif ... (que además puede llegar a evaluar por duplicado isinstance(value,list), que es mucho mejor, oiga) |
Code Climate has analyzed commit 3ff199a and detected 0 issues on this pull request. View more on Code Climate. |
* NOV-244340: expression for selecting in an array for a context storage (#388) * chore: base code for selecting in an array using expresions like a.[key='value'].b * fix: previous unitary tests with the new code * test: add positive unitary tests for the new feature * test: add negative unitary tests * doc: updated methods docstring * doc: updated changelog * fix: flake8 format for unitary testing * fix: flake8 format for dataset module * chore: adapt code to codeclimate bot stupidity * test: add unitary test for invalid list structure * fix: upgrade Faker version to 25.9 (#394) * fix: upgrade Faker version to 25.9 * fix Firefox unittests * bug(QAWTO-212): fix result for action before the feature error with background (#397) * bug(QAWTO-212): fix action before the feature with background output with error * fix(QAWTO-212): fix flake8 linter messages * fix(QAWTO-212): move behave import to selected function * docs(QAWTO-212): update changelog * feat: add initial integration of playwright (#387) * feat: add initial integration of playwright * avoid error in after_scenario * feat: reuse toolium driver and pageobjects for playwright tests (#389) * chore: include playwright module on setup (#391) * chore: include playwright module on setup * feat: playwright enable headless config (#392) * feat: stop playwright when driver is closed (#393) * playwright start by browser * avoid duplications for ConfigDriver instance * fix lint --------- Co-authored-by: robertomier <[email protected]> Co-authored-by: Rubén González Alonso <[email protected]> Co-authored-by: Ricardo García Fernández <[email protected]>
So far....
Expressions starting with CONTEXT let us select elements saved in context or context.storage like
recently, the index in arrays was added, so that
Now...
let's go a bit deeper and let's have a mechanism of selecting elements in an array of dictionaries by searching for an specific key, like this:
having this next structure saved in the context
we are now able to select like
[CONTEXT:the_array.id=first-element.text]
and the 'The value of the first element' will be returnedyou can also use single or double quotes for the selection expression (id='first-element', "id"="first-element", etc..)