コード例 #1
0
    def test_calculate_weather_delay(self):
        """
        Tests calculate_weather_delay()

        """

        weatherDelay = ArraySystem(input_dict=self.input_dict,
                                   output_dict=self.output_dict,
                                   project_name=self.project_name)
        weatherDelay.run_module()
コード例 #2
0
    def test_ArraySystemModule(self):
        """
        Black box test to check whether module is ran successfully or not
        """
        run_ArraySystem = ArraySystem(input_dict=self.input_dict,
                                      output_dict=self.output_dict,
                                      project_name=self.project_name)
        trial_run = run_ArraySystem.run_module()

        if trial_run[0] == 0:
            print(
                '\n\n================== MODULE EXECUTION SUCCESS =========================\n'
            )
            print(
                ' ArraySystem module ran successfully. See the list of inputs'
                '\n and outputs below used by the module in its calculations:')
            print(
                '\n=====================================================================\n'
            )

        elif trial_run[0] == 1:
            print(
                '\n\n====================================== MODULE EXECUTION FAILURE ======================================\n'
            )
            print(
                ' > ArraySystem module failed to run successfully. Error detected: ',
                trial_run[1],
                '\n > Scroll below to see detailed information about error encountered.'
                '\n > See the list of inputs below used by the module in its calculations:'
            )
            print(
                '\n========================================================================================================\n'
            )

        print(
            '\nGiven below is the set of inputs fed into ArraySystem module:\n'
        )
        for key, value in self.input_dict.items():
            print(key, ':', value)

        if trial_run[0] == 0:  #Only print outputs if module ran successfully.
            print(
                '\nGiven below is the set of outputs calculated by the ArraySystem module:\n'
            )
            for k, v in self.output_dict.items():
                if isinstance(v, dict):
                    for a, b in v.items():
                        if isinstance(b, pd.DataFrame):
                            return
                        else:
                            print('\nGiven below are attributes of cable ', a,
                                  ':\n')
                            for c, d in b.__dict__.items():
                                print(c, ':', d)
                            print('\n<----End of cable attributes---->\n')
                else:
                    if isinstance(v, pd.DataFrame):
                        print('\nNow printing DataFrame ->', k, ':\n', v)
                    else:
                        print(k, ':', v)
コード例 #3
0
 def test_ArraySystem(self):
     run_collection = ArraySystem(self.input_dict,
                                  self.output_dict,
                                  project_name=self.project_name)
     run_collection.run_module()