From: Naveen Anandhan Date: Sun, 22 Feb 2026 09:55:36 +0000 (+0530) Subject: selftests: tc-testing: preserve list order when removing duplicates X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ac768bb198ccdb1b6dde4bb3616a115642de65c;p=thirdparty%2Flinux.git 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 Link: https://patch.msgid.link/20260222095536.17371-1-mr.navi8680@gmail.com Signed-off-by: Paolo Abeni --- diff --git a/tools/testing/selftests/tc-testing/tdc_helper.py b/tools/testing/selftests/tc-testing/tdc_helper.py index 0440d252c4c5f..e06f03c0fb5d5 100644 --- a/tools/testing/selftests/tc-testing/tdc_helper.py +++ b/tools/testing/selftests/tc-testing/tdc_helper.py @@ -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