embpy08.gms : Test filtered load from Embedded Code

Description

This test ensures that we get the expected result when doing a filtered load
from embedded code. The symbol to be loaded has some records which violate
the given domain and should be just ignored.

Contributor: Lutz Westermann, March 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embpy08.gms

$title Test filtered load from Embedded Code (EMBPY08,SEQ=860)

$ontext
This test ensures that we get the expected result when doing a filtered load
from embedded code. The symbol to be loaded has some records which violate
the given domain and should be just ignored.

Contributor: Lutz Westermann, March 2021
$offtext


* On the major platforms (Windows, Linux, Mac), GMSPYTHONLIB gets automatically set 
* to use the internal Python installation in sysdir/GMSPython.
$if not setEnv GMSPYTHONLIB $abort.noError Embedded code Python not ready to be used
$log --- Using Python library %sysEnv.GMSPYTHONLIB%

$onEcho > makeWant.gms
Set
   i          /1*2/
   w          /1*2/
   s          / s1/ ;

Parameter QtableScen(s,i,w) / 's1'.'1'.'1' 2 
                              's1'.'1'.'2' 2 /;
$offEcho

$call.checkErrorlevel gams makeWant.gms gdx=want lo=%GAMS.lo%


Set
   i          /1*2/
   w          /1*2/
   s                ;

Parameter QtableScen(s<,i,w);

$onEmbeddedCode Python:
gams.db['QtableScen'].add_record(['s1','1','1']).value = 2
gams.db['QtableScen'].add_record(['s1','1','2']).value = 2
gams.db['QtableScen'].add_record(['s1','3','1']).value = 2
gams.db['QtableScen'].add_record(['s1','3','2']).value = 2
$offEmbeddedCode QtableScen

execute_unloadDI 'have', QtableScen;

execute.checkErrorlevel 'gdxdiff want.gdx have.gdx > %system.nullFile%';