예제 #1
0
    def test_solid_part_system(self):
        """
        System test starting with the following top level function:
        
        custom_checks._ExecCheckSolidPartElements(ANSAPart, _ ) -> [CheckReport]
        """

        nada = None  #blank variable to pass to _exec function

        #            #
        #Pass section#
        #            #

        base.Or(self.pass_parts)
        output1 = custom_checks._ExecCheckSolidPartElements(
            self.pass_parts, nada)
        report1 = output1[0]

        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report1.issues), 0,
            "There is a problem in the following file(s): " +
            str([x.issues.entities._name for x in report1.issues]))

        #            #
        #fail section#
        #            #

        base.Or(self.fail_parts)
        output2 = custom_checks._ExecCheckSolidPartElements(
            self.fail_parts, nada)
        report2 = output2[0]
        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report2.issues), self.fail_n_parts,
            "The size of the return list is different. List contents: " +
            str([x for x in report2.issues]))

        part_name_regression = [part._name for part in self.fail_parts]

        part_in_issues = []
        for issue in report2.issues:
            part_in_issues += issue.entities

        part_names_in_issues = [part._name for part in part_in_issues]

        set_names = set(part_names_in_issues)
        set_names_regression = set(part_name_regression)

        regression_difference = set_names_regression - set_names
        new_difference = set_names - set_names_regression

        print_error = determine_print_message(regression_difference,
                                              new_difference)

        self.assertEqual(set_names, set_names_regression, print_error)
예제 #2
0
    def test_connectivity_exec_system(self):
        """
        System test starting with the following top level function:
        
        custom_checks._ExecCheckConnectivity([ANSAPart], _ ) -> [CheckReport]
        """

        nada = None  #blank variable to pass to _exec function

        #                 #
        #fail section#
        #                #

        for part in self.fail_parts:
            base.Or(part)
            output = custom_checks._ExecCheckConnectivity([part], nada)
            correct_status = "error"
            self.assertTrue(
                output[0].status == correct_status,
                "Part " + str(output[0].description) + " Has the status " +
                str(output[0].status) + " which is not " + correct_status +
                ".")

        #                        #
        #Warning section#
        #                        #

        for part in self.warn_parts:
            base.Or(part)
            output = custom_checks._ExecCheckConnectivity([part], nada)
            correct_status = "warning"
            self.assertTrue(
                output[0].status == correct_status,
                "Part " + str(output[0].description) + " Has the status " +
                str(output[0].status) + " which is not " + correct_status +
                ".")

        #                    #
        #pass section#
        #                   #
        for part in self.ok_parts:
            base.Or(part)
            output2 = custom_checks._ExecCheckConnectivity(part, nada)
            report2 = output2[0]
            self.assertEqual(
                len(report2.issues), 0,
                "There is a problem in the following file(s): " + part._name)
예제 #3
0
    def test_shell_thickness_exec_system(self):
        """
        System test starting with the following top level function:
        
        custom_checks._ExecutePshell(ANSAPart, _ ) -> [CheckReport]
        """

        nada = None  #blank variable to pass to _exec function

        #                 #
        #fail section#
        #                #

        base.Or(self.fail_parts)
        output1 = custom_checks._ExecutePshell(self.fail_parts, nada)
        report1 = output1[0]

        part_set_names = pull_parts_from_exec_output(report1, "error", 3288)

        part_set_names_regression = pull_parts_from_resources(self.fail_parts)

        group_names_minus_exec_names = part_set_names_regression - part_set_names
        exec_names_minus_group_names = part_set_names - part_set_names_regression

        print_error = determine_print_message(group_names_minus_exec_names,
                                              exec_names_minus_group_names)

        self.assertEqual(part_set_names, part_set_names_regression,
                         print_error)

        #                    #
        #pass section#
        #                   #

        base.Or(self.ok_parts)
        output2 = custom_checks._ExecutePshell(self.ok_parts, nada)
        report2 = output2[0]

        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report2.issues), 0,
            "There is a problem in the following file(s): " +
            str([x.issues.entities._name for x in report2.issues]))
예제 #4
0
    def test_material_exec_system(self):
        """
        System test starting with the following top level function:
        
        custom_checks._ExecCheckMaterials(ANSAPart, _ ) -> [CheckReport]
        """
        nada = None  #blank variable to pass to _exec function

        #                    #
        #warn section#
        #                   #

        base.Or(self.warn_parts)
        output1 = custom_checks._ExecCheckMaterials(self.warn_parts, nada)
        report1 = output1[0]

        part_set_names = pull_parts_from_exec_output(report1, "warning")

        part_set_names_regression = pull_parts_from_resources(self.warn_parts)

        group_names_minus_exec_names = part_set_names_regression - part_set_names
        exec_names_minus_group_names = part_set_names - part_set_names_regression

        print_error = determine_print_message(group_names_minus_exec_names,
                                              exec_names_minus_group_names)

        self.assertEqual(part_set_names, part_set_names_regression,
                         print_error)

        #                           #
        #mismatch section#
        #                          #

        base.Or(self.mismatch_parts)
        output2 = custom_checks._ExecCheckMaterials(self.mismatch_parts, nada)
        report2 = output2[0]
        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report2.issues), self.mismatch_n_parts,
            "The size of the return list is different. List contents: " +
            str([x for x in report2.issues]))

        part_set_names = pull_parts_from_exec_output(report2, "error")

        part_set_names_regression = pull_parts_from_resources(
            self.mismatch_parts)

        group_names_minus_exec_names = part_set_names_regression - part_set_names
        exec_names_minus_group_names = part_set_names - part_set_names_regression

        print_error = determine_print_message(group_names_minus_exec_names,
                                              exec_names_minus_group_names)

        self.assertEqual(part_set_names, part_set_names_regression,
                         print_error)

        #                #
        #ok section#
        #                #

        base.Or(self.ok_parts)
        output3 = custom_checks._ExecCheckMaterials(self.ok_parts, nada)
        report3 = output3[0]

        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report3.issues), 0,
            "There is a problem in the following file(s): " +
            str([x.issues.entities._name for x in report3.issues]))

        #                 #
        #fail section#
        #                #

        base.Or(self.fail_parts)
        output4 = custom_checks._ExecCheckMaterials(self.fail_parts, nada)
        report4 = output4[0]
        #Making sure the only return is just the report object within a list.
        self.assertEqual(
            len(report4.issues), self.fail_n_parts,
            "The size of the return list is different. List contents: " +
            str([x for x in report4.issues]))

        part_set_names = pull_parts_from_exec_output(report4, "error")

        part_set_names_regression = pull_parts_from_resources(self.fail_parts)

        group_names_minus_exec_names = part_set_names_regression - part_set_names
        exec_names_minus_group_names = part_set_names - part_set_names_regression

        print_error = determine_print_message(group_names_minus_exec_names,
                                              exec_names_minus_group_names)

        self.assertEqual(part_set_names, part_set_names_regression,
                         print_error)