def calculate_patch(stea_input): return SteaResult( { SteaKeys.KEY_VALUES: [ {SteaKeys.TAX_MODE: SteaKeys.CORPORATE, SteaKeys.VALUES: {"NPV": 30}} ] }, stea_input, )
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") result = SteaResult(mock_result, stea_input) with self.assertRaises(KeyError): res = result.results("NO-SUCH-TAX-MODE") res = result.results(SteaKeys.PRETAX) self.assertEqual(len(res), 1) self.assertIn("NPV", res) self.assertEqual(res["NPV"], 123) res = result.results(SteaKeys.CORPORATE) self.assertEqual(len(res), 1) self.assertIn("NPV", res) self.assertEqual(res["NPV"], 456) if __name__ == "__main__":