27 $load pythonUndef pythonNA pythonPInf pythonMInf pythonEps
33 abort$(GUndef <> pythonUndef) 'pythonUndef not as expected', GUndef, pythonUndef;
34 abort$(GNA <> pythonNA ) 'pythonNA not as expected', GNA, pythonNA;
35 abort$(GPInf <> pythonPInf ) 'pythonPInf not as expected', GPInf, pythonPInf;
36 abort$(GMInf <> pythonMInf ) 'pythonMInf not as expected', GMInf, pythonMInf;
37 abort$(GEps <> pythonEps ) 'pythonEps not as expected', GEps, pythonEps;'''
40 if __name__ ==
"__main__":
43 ws = GamsWorkspace(system_directory = sys.argv[1])
47 dbIn = ws.add_database(in_model_name =
"myDB")
48 dbIn.add_parameter(
"pythonUndef", 0).add_record().value = SV_UNDEF
49 dbIn.add_parameter(
"pythonNA", 0).add_record().value = float(
'nan')
50 dbIn.add_parameter(
"pythonPInf", 0).add_record().value = float(
'inf')
51 dbIn.add_parameter(
"pythonMInf", 0).add_record().value = float(
'-inf')
52 dbIn.add_parameter(
"pythonEps", 0).add_record().value = SV_EPS
56 gj.run(databases = dbIn)
59 GUndef = dbOut[
"GUndef"].first_record().value
60 if GUndef != SV_UNDEF:
61 raise Exception(
"GUndef not as expected: " + str(GUndef))
62 GNA = dbOut[
"GNA"].first_record().value
63 if not math.isnan(GNA):
64 raise Exception(
"GNA not as expected: " + str(GNA))
65 GPInf = dbOut[
"GPInf"].first_record().value
66 if GPInf != float(
'inf'):
67 raise Exception(
"GPInf not as expected: " + str(GPInf))
68 GMInf = dbOut[
"GMInf"].first_record().value
69 if GMInf != float(
'-inf'):
70 raise Exception(
"GMInf not as expected: " + str(GMInf))
71 GEps = dbOut[
"GEps"].first_record().value
73 raise Exception(
"GEps not as expected: " + GEps);
74 except Exception
as e:
75 raise Exception(
"\n###\n### Exception caught:" + str(e) +
"\n###")