I have two lists of test results. The test results are presented in the form of dictionaries:
list1 = [{testclass='classname', testname='testname', testtime='...},...]
list2 = [{testclass='classname', testname='testname', ...},...]
In both lists, the presentation of the dictionary is slightly different, because for one list I have a little more information. But in all cases, each test dictionary in any list will have a class name and the element name testname, which together form a way to uniquely identify the test and a way to compare it in lists.
I need to find out all the tests that are in list1 but not in list2, as they represent new testing failures.
To do this, I:
def get_new_failures(list1, list2):
new_failures = []
for test1 in list1:
for test2 in list2:
if test1['classname'] == test2['classname'] and \
test1['testname'] == test2['testname']:
break;
new_failures.append(test1);
return new_failures;
, python. . , , . , , . .
,
.