def main_entry_point(args=None): parser = _get_args_parser() options = parser.parse_args(args) stea_input = stea.SteaInput([options.config]) res = stea.calculate(stea_input) for res, value in res.results(stea.SteaKeys.CORPORATE).items(): with open("{}_0".format(res), "w") as ofh: ofh.write("{}\n".format(value))
def test_calculate(self): with TestAreaContext("stea_request"): case = create_case() case.fwrite() with open("config_file","w") as f: f.write("{}: {}\n".format(SteaInputKeys.CONFIG_DATE, self.config_date)) f.write("{}: {}\n".format(SteaInputKeys.PROJECT_ID, self.project_id)) f.write("{}: {}\n".format(SteaInputKeys.PROJECT_VERSION, self.project_version)) f.write("{}: \n".format(SteaInputKeys.ECL_PROFILES)) f.write(" {}: \n".format(self.fopt_profile_id)) f.write(" {}: FOPT\n".format(SteaInputKeys.ECL_KEY)) f.write("{}: {}\n".format(SteaInputKeys.SERVER, test_server)) f.write("{}: \n".format(SteaInputKeys.RESULTS)) f.write(" - NPV\n") f.write("{}: {}\n".format(SteaInputKeys.ECL_CASE, "CSV")) stea_input = SteaInput("config_file") results = calculate(stea_input)
def main_entry_point(): parser = _get_args_parser() options = parser.parse_args() stea_input = stea.SteaInput([options.config]) result = stea.calculate(stea_input) for res, value in result.results(stea.SteaKeys.CORPORATE).items(): with open("{}_0".format(res), "w") as ofh: ofh.write("{}\n".format(value)) profiles = _get_profiles( stea_input.stea_server, stea_input.project_id, stea_input.project_version, stea_input.config_date, ) full_response = _build_full_response(result.data[stea.SteaKeys.KEY_VALUES], profiles) with open(options.response_file, "w") as fout: json.dump(full_response, fout, indent=4)
def test_calculate(set_up): with TestAreaContext("stea_request"): case = create_case() case.fwrite() with open("config_file", "w") as f: f.write("{}: {}\n".format(SteaInputKeys.CONFIG_DATE, set_up.config_date)) f.write("{}: {}\n".format(SteaInputKeys.PROJECT_ID, set_up.project_id)) f.write("{}: {}\n".format(SteaInputKeys.PROJECT_VERSION, set_up.project_version)) f.write("{}: \n".format(SteaInputKeys.ECL_PROFILES)) f.write(" {}: \n".format(set_up.fopt_profile_id)) f.write(" {}: FOPT\n".format(SteaInputKeys.ECL_KEY)) f.write("{}: {}\n".format(SteaInputKeys.SERVER, test_server)) f.write("{}: \n".format(SteaInputKeys.RESULTS)) f.write(" - NPV\n") f.write("{}: {}\n".format(SteaInputKeys.ECL_CASE, "CSV")) stea_input = SteaInput(["config_file"]) results = calculate(stea_input) for res, value in results.results(SteaKeys.CORPORATE).items(): print("DBG_TEST {}, {}".format(res, value))