Description
This test ensures that $onECImplicitLoad/$offECImplicitLoad behaves correctly with Embedded Code Python Contributor: Clemens Westphal, February 2022
Small Model of Type : GAMS
Category : GAMS Test library
Main file : embpy12.gms
$title 'Test implicit/explicit loading in Embedded Code' (EMBPY12,SEQ=896)
$onText
This test ensures that $onECImplicitLoad/$offECImplicitLoad behaves correctly
with Embedded Code Python
Contributor: Clemens Westphal, February 2022
$offText
$log --- Using Python library %sysEnv.GMSPYTHONLIB%
set s1(*), s2(*);
* Load sets implicitly
$onECImplicitLoad
$if not errorfree $abort "Unexpected data"
* Load sets explicitly
$clear s1 s2
$onMulti
$if not errorfree $abort "Unexpected data"
$offMulti
* Mix implicit and explicit loading
$clear s1 s2
$onMulti
$if not errorfree $abort "Unexpected data"
$offMulti
* Load parameter implicitly
parameter p1(s1, s2);
$if not errorfree $abort "Unexpected data"
* Load domain set implicitly
$onMultiR
$clear s1 s2
$if not errorfree $abort "Unexpected data"
$offMulti
* Generate a domain violation with implicit loading and DomainCheckType.CHECKED
$clear p1
$onMulti
$if errorfree $abort "Expected domain violation"
$clearError
$if not errorfree $abort "Unexpected data"
$offMulti
* Generate a domain violation with implicit loading and $offFiltered
$clear p1
$onMulti
$offFiltered
$if errorfree $abort "Expected domain violation"
$clearError
$onFiltered
$if not errorfree $abort "Unexpected data"
$offMulti
* Load a set implicitly by setting the alias
set s3(*);
alias(s3, s3_alias);
$if not errorfree $abort "Problem with alias"
* Load implicitly using the projection operator
set s4;
parameter p2(s4);
$if not errorfree $abort "Problems with the projection operator and implicit load"
$if not errorfree $abort "Unexpected data"
* Load implicitly from a set using the projection operator
set s5(s5);
$if not errorfree $abort "Problems loading implicitly from a set using the projection operator"
$if not errorfree $abort "Unexpected data"
* Load implicitly using the projection operator and fixed domain position
set s6;
parameter p3(s1, s6);
$if not errorfree $abort "Problems with the projection operator and implicit load and fixed domain position"
$if not errorfree $abort "Unexpected data"
* Generate a compilation error by loading a parameter that has not been set
parameter p4(s1);
$if errorfree $abort "Expected an error when loading a symbol that has not been set with $onECImplicitLoad"
$clearError
$offECImplicitLoad
* Load explicitly using the projection operator
set s7;
parameter p5(s7);
$if not errorfree $abort "Problems with the projection operator and explicit load"
$if not errorfree $abort "Unexpected data"
* Load explicitly from a set using the projection operator
set s8(s8);
$if not errorfree $abort "Problems loading explicitly from a set using the projection operator"
$if not errorfree $abort "Unexpected data"
* Load explicitly using the projection operator and fixed domain position
set s9;
parameter p6(s1,s9);
$if not errorfree $abort "Problems with the projection operator and explicit load and fixed domain position"
$if not errorfree $abort "Unexpected data"
* Generate a compilation error by loading a parameter that has not been set
$if errorfree $abort "Expected an error when loading a symbol that has not been set with $offECImplicitLoad"
$clearError