I do have a dict of ditcs; This needs to get sorted in a way FAIL group appears first in the dict followed by pass (even if there is one "FAIL" condition they should be grouped together).
To add more details if I were to sort in alphabetical order of the values I would do like
sorted_d1=collections.OrderedDict(d1.items(),lambda x:x[1])
but if I were to find for "FAIL" string in the values and group them, how am I supposed to do that? Kindly help on this
d1 =
{
'test1':{'condition1':'PASS','condition2':'FAIL','condition3':'-'},
'test2':{'condition1':'PASS','condition2':'PASS','condition3':'-'},
'test3':{'condition1':'-' ,'condition2':'PASS','condition3':'-'},
'test4':{'condition1':'PASS','condition2':'-' ,'condition3':'-'},
'test5':{'condition1':'-' ,'condition2':'FAIL','condition3':'-'},
'test6':{'condition1':'FAIL','condition2':'PASS','condition3':'-'},
'test7':{'condition1':'FAIL','condition2':'-' ,'condition3':'-'}
}
sorted_d1 =
{
'test1':{'condition1':'PASS','condition2':'**FAIL**','condition3':'-'},
'test5':{'condition1':'-' ,'condition2':'**FAIL**','condition3':'-'},
'test6':{'condition1':'**FAIL**','condition2':'PASS','condition3':'-'},
'test7':{'condition1':'**FAIL**','condition2':'-' ,'condition3':'-'},
'test2':{'condition1':'PASS','condition2':'PASS','condition3':'-'},
'test3':{'condition1':'-' ,'condition2':'PASS','condition3':'-'},
'test4':{'condition1':'PASS','condition2':'-' ,'condition3':'-'}
}