-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Collections: Support ignoring order in values when comparing dictionaries #5007
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
Although Python nowadays preserves dictionary order, the order doesn't generally affect equality and it shouldn't matter with this keyword either. Do you have a concrete example where
If we agree adding this functionality would be a good idea, can you provide a pull request implementing it? |
In my case I'm querying an API (fastapi) where item order (in case of lists) and key order (in case of dictionaries) is not enforced. The DUT , after a reboot will give a different order making the test very brittle and causing it to fail.
This is the error that I'm getting :
This is the request / var ${POST_PROFILE_SAFESEARCH_RESPONSE}
So basically the API might return different orders for the search engines. In this case ignore_order would be needed.
I would love to and would have already done it but I don't have the right confidence with python. |
So you don't want to ignore order of dictionary keys but instead want to ignore order in their values? I guess something like Is there a reason you couldn't get those values and use |
Exactly, and yes ignore_value_order would be appropriate. |
We got PR #5220 implementing this. It looks good but I cannot review it properly now. I added this issue to RF 7.2 scope and review it later. |
I finally got PR #5220 reviewed. It has an unrelated change to sorting unsortable items which should be removed (and possibly added as part of a separate issue and PR), but it looks very good otherwise. |
Currently https://github.com/robotframework/robotframework/blob/master/src/robot/libraries/Collections.py#L839 we are missing out on ignore_order already done for
Ref : ngoan1608@1d85220#diff-0bb57664ba32d4e2b91c6435cf0b867d630c2db282af83004073303030775bd1
Adding as well ignore_key would be much appreciated since we might deal with ID's and timestamps, and in such cases those keys are to be ignored.
The text was updated successfully, but these errors were encountered: