mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-18 13:31:45 -04:00
selftests: tc-testing: preserve list order when removing duplicates
Using set() removes duplicates but breaks ordering. Test output should be deterministic, so replace with dict.fromkeys(). Signed-off-by: Naveen Anandhan <mr.navi8680@gmail.com> Link: https://patch.msgid.link/20260222095536.17371-1-mr.navi8680@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
f77c7b9601
commit
8ac768bb19
@@ -16,9 +16,9 @@ def get_categorized_testlist(alltests, ucat):
|
||||
|
||||
|
||||
def get_unique_item(lst):
|
||||
""" For a list, return a list of the unique items in the list. """
|
||||
"""Return unique items while preserving original order."""
|
||||
if len(lst) > 1:
|
||||
return list(set(lst))
|
||||
return list(dict.fromkeys(lst))
|
||||
else:
|
||||
return lst
|
||||
|
||||
|
||||
Reference in New Issue
Block a user