Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7131af3

Browse files
committed
Fine to Lists Should Be Equal documentation related to #2703.
Also tab to spaces in a test.
1 parent 0032b78 commit 7131af3

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

atest/testdata/standard_libraries/collections/list.robot

+3-3
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ Lists Should Be Equal With Named Indices As Dictionary With Too Few Values
331331
${names} = Create Dictionary 0=a 2=c
332332
Lists Should Be Equal ${L3} ${L3B} names=${names}
333333

334-
Lists Should Be Equal Ignore Order
334+
Lists Should Be Equal Ignore Order
335335
${list1} = Create List A B C D
336-
${list2} = Create List D B C A
336+
${list2} = Create List D B C A
337337
Lists Should Be Equal ${list1} ${list2} ignore_order=True
338-
338+
339339
List Should Contain Sub List
340340
List Should Contain Sub List ${LONG} ${L4}
341341

src/robot/libraries/Collections.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,12 @@ def lists_should_be_equal(self, list1, list2, msg=None, values=True,
364364
- If ``msg`` is given and ``values`` is not given a true value,
365365
the error message is just the given ``msg``.
366366
367-
Optional ``names`` argument can be used for naming the indices shown in
368-
the default error message. It can either be a list of names matching
369-
the indices in the lists or a dictionary where keys are indices that
370-
need to be named. It is not necessary to name all of the indices. When
371-
using a dictionary, keys can be either integers or strings that can be
372-
converted to integers.
373-
374-
Optional ``ignore_order`` argument can be used to ignore the order of the
375-
elements (element index) in the list while comparing two lists. If set to
376-
true, element order will be ignored. This option is new in RF 3.2 now.
367+
The optional ``names`` argument can be used for naming the indices
368+
shown in the default error message. It can either be a list of names
369+
matching the indices in the lists or a dictionary where keys are
370+
indices that need to be named. It is not necessary to name all of
371+
the indices. When using a dictionary, keys can be either integers
372+
or strings that can be converted to integers.
377373
378374
Examples:
379375
| ${names} = | Create List | First Name | Family Name | Email |
@@ -384,13 +380,15 @@ def lists_should_be_equal(self, list1, list2, msg=None, values=True,
384380
If the items in index 2 would differ in the above examples, the error
385381
message would contain a row like ``Index 2 (email): [email protected] !=
386382
387-
383+
384+
The optional ``ignore_order`` argument can be used to ignore the order
385+
of the elements in the lists. Using it requires items to be sortable.
386+
This is new in Robot Framework 3.2.
387+
388+
Example:
388389
| ${list1} = | Create List | apple | cherry | banana |
389390
| ${list2} = | Create List | cherry | banana | apple |
390391
| Lists Should Be Equal | ${list1} | ${list2} | ignore_order=True |
391-
392-
list index would be ignored while comparing two lists. Above two list
393-
will be matched.
394392
"""
395393
self._validate_lists(list1, list2)
396394
len1 = len(list1)

0 commit comments

Comments
 (0)