Commit 9ef4ce05 authored by Giuseppe Tropea's avatar Giuseppe Tropea
Browse files

checking the clause from PICS

parent ae8b6eee
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -112,7 +112,7 @@ if __name__ == "__main__":
    # unpack all permutations of testcases that are under the same .robot file
    # unpack all permutations of testcases that are under the same .robot file
    permutations = []
    permutations = []
    for testcase in testcases:
    for testcase in testcases:
        print("--parsing "+testcase["robotfile"])
        #print("--parsing "+testcase["robotfile"])
        permutation_metadata = {}
        permutation_metadata = {}
        # everything that is at the top level shall be extracted
        # everything that is at the top level shall be extracted
        for key, value in testcase.items():
        for key, value in testcase.items():
@@ -126,18 +126,25 @@ if __name__ == "__main__":
            for permutation_body in testcase["test_cases"]:
            for permutation_body in testcase["test_cases"]:
                if "permutation_tp_id" in permutation_body:
                if "permutation_tp_id" in permutation_body:
                    ptpid =  permutation_body["permutation_tp_id"]
                    ptpid =  permutation_body["permutation_tp_id"]
                    print("::: "+ptpid)
                    #print("::: "+ptpid)
                    # strip from beginning up to including the last "/"
                    # strip from beginning up to including the last "/"
                    permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:]
                    permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:]
                    # use the stripped_permutation_tp_id as text of the link
                    # use the stripped_permutation_tp_id as text of the link
                    permutation_body["robotlink"] = "<a href=\""+fullurl+"\">" + permutation_body["stripped_permutation_tp_id"] + "</a>"
                    permutation_body["robotlink"] = "<a href=\""+fullurl+"\">" + permutation_body["stripped_permutation_tp_id"] + "</a>"
                    # So basically we append to the permutations a new dict that is the | unione merge of the
                    # So basically we append to the permutations a new dict that is the | union merge of the
                    # items of the template merged with the items of the concatenation of {**permutation_metadata, **permutation_body}
                    # items of the template merged with the items of the concatenation of {**permutation_metadata, **permutation_body}
                    # For this last concatenation we use the unpacking python operator ** that strips the container dict from both
                    # For this last concatenation we use the unpacking python operator ** that strips the container dict from both
                    #permutations.append(dict(permutation_template.items() | {**permutation_metadata, **permutation_body}.items()))
                    #permutations.append(dict(permutation_template.items() | {**permutation_metadata, **permutation_body}.items()))
                    a = {**permutation_metadata, **permutation_body}
                    a = {**permutation_metadata, **permutation_body}
                    b = {**permutation_template, **a}
                    unpacked_testcase = {**permutation_template, **a}
                    permutations.append(b)
                    # Perform a check on the clause number, by "PICS_6_3_4" ---> "6_3_4"
                    clause_from_pic = unpacked_testcase["pics_selection"][len("PICS_"):]
                    if clause_from_pic not in unpacked_testcase["tags"]:
                        print("Not in TAGSGG")
                        print(unpacked_testcase)
                        #exit(1)
                    unpacked_testcase["clause"] = clause_from_pic.replace("_", ".")
                    permutations.append(unpacked_testcase)
                else:
                else:
                    print("NO PERMUTATION TP ID")
                    print("NO PERMUTATION TP ID")
                    exit(1)
                    exit(1)