Repository navigation
List ignore - #3469
List ignore#3469
Conversation
|
I am working on fixing the tests, |
|
@finally all tests passed. Today I learn new thing on test expected value!!! |
|
@tysonite @pekkaklarck can you please review. |
laurentbristiel
left a comment
There was a problem hiding this comment.
just one missing space. Thanks!
|
is this RF 3.2 Candidate ? |
| else: | ||
| sorted_list1 = sorted(list1) | ||
| sorted_list2 = sorted(list2) | ||
| diffs = list(self._yield_list_diffs(sorted_list1, sorted_list2, names)) |
There was a problem hiding this comment.
This looks a bit more complicated than needed. AFAIK this would be enough:
if ignore_order:
list1 = sorted(list1)
list2 = sorted(list2)| names=None, ignore_order=False): | ||
| """Fails if given lists are unequal. | ||
|
|
||
| The keyword first verifies that the lists have equal lengths, and then |
There was a problem hiding this comment.
The new option needs to be explained in the documentation, possibly with an example. A note about the option being new in Robot Framework 3.2 is needed as well.
|
|
||
| Lists Should Be Equal Ignore Order | ||
| ${names1} = Create List A B C D | ||
| ${names2} = Create List D B C A |
There was a problem hiding this comment.
It looks a bit strange that the separator between arguments is different. Using four spaces consistently would be better. These values aren't names either so probably variables should be just ${list1} and ${list2}.
There was a problem hiding this comment.
Somehow formatting of this shown differently but I just checked checked in file here and it
shows correct.
https://user-images.githubusercontent.com/33742811/74623859-3ffbb600-516c-11ea-86ac-902a73a13862.png
|
Yeah, this can easily be included to RF 3.2. Please take a look at the review comments. I hope you can fix them all so that I can simply merge this online without any further changes. |
|
|
||
| Lists Should Be Equal Ignore Order | ||
| ${list1} = Create List A B C D | ||
| ${list2} = Create List D B C A |
There was a problem hiding this comment.
There's probably a tab between C and A. I can fix that myself.
|
Changes done @pekkaklarck |
|
Looks good to me. Documentation could perhaps be enhanced a bit but I can do that after merging. Thanks! |
|
well... is that work all time? test in python3.6.8 >>> sorted([{1,2}, {3,4}]) == sorted([{4,3}, {2,1}])
Falsebut since set is orderless, i expect the above can pass the compare |
|
That seems to be some Python oddity: >>> sorted([{1, 2}, {3,4}])
[{1, 2}, {3, 4}]
>>> sorted([{3, 4}, {1, 2}])
[{3, 4}, {1, 2}]My guess is that sets cannot compared. Anyway, nothing we really can do anything. |

As list is mutable and if we use sort, it will alter original list. Original list should not be altered so used sorted function instead of sort method.
Instead of modify more lines in the _yield_list_diffs method to handle
nameoption given by user, just passed sorted list to get the diff as we should support name argument/parameter as well.