From: Brenda J. Butler Date: Tue, 31 Oct 2017 18:28:35 +0000 (-0400) Subject: tc-testing: better check if thing is list X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=6c26c3fbc3295ce71f5e03caccc9eeb7369123ca;p=openwrt%2Fstaging%2Fblogic.git tc-testing: better check if thing is list Check if tcase[k] is an instance of a list (is or is derived from list) instead of checking if it is a list. This will be useful if the data structures change to be something that implements list, instead of being an actual list. In that case, this code will not have to change. Signed-off-by: Brenda J. Butler Acked-by: Lucas Bates Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/tc-testing/tdc_helper.py b/tools/testing/selftests/tc-testing/tdc_helper.py index 6f99a4efe761..d935cbc34cc3 100644 --- a/tools/testing/selftests/tc-testing/tdc_helper.py +++ b/tools/testing/selftests/tc-testing/tdc_helper.py @@ -57,7 +57,7 @@ def print_sll(items): def print_test_case(tcase): """ Pretty-printing of a given test case. """ for k in tcase.keys(): - if (type(tcase[k]) == list): + if (isinstance(tcase[k], list)): print(k + ":") print_list(tcase[k]) else: