Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Naveen Anandhan and committed by
Paolo Abeni
8ac768bb f77c7b96

+2 -2
+2 -2
tools/testing/selftests/tc-testing/tdc_helper.py
··· 16 16 17 17 18 18 def get_unique_item(lst): 19 - """ For a list, return a list of the unique items in the list. """ 19 + """Return unique items while preserving original order.""" 20 20 if len(lst) > 1: 21 - return list(set(lst)) 21 + return list(dict.fromkeys(lst)) 22 22 else: 23 23 return lst 24 24