embpy06.gms : Test domain check/filtered when loading data from embedded code

Description

Contributor: Michael Bussieck, November 2019


Small Model of Type : GAMS


Category : GAMS Test library


Main file : embpy06.gms

$title 'Test domain check/filtered when loading data from embedded code' (EMBPY06,SEQ=805)

$onText
Contributor: Michael Bussieck, November 2019
$offText


$log --- Using Python library %sysEnv.GMSPYTHONLIB%

Set       universe / i1 /
          s(universe);

$onMultiR
$onEmbeddedCode Python:
  gams.set('s', [('I2')])
$offEmbeddedCode s
$if not errorFree $abort 'No error expected'
$ifE card(s)<>0 $abort 'Expected empty s'

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.FILTERED)
$offEmbeddedCode s
$if not errorFree $abort 'No error expected'
$ifE card(s)<>0 $abort 'Expected empty s'

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.DEFAULT)
$offEmbeddedCode s
$if not errorFree $abort 'No error expected'
$ifE card(s)<>0 $abort 'Expected empty s'

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.CHECKED)
$offEmbeddedCode s
$if errorFree $abort 'Error expected'
$clearErrors

$offFiltered

$onEmbeddedCode Python:
  gams.set('s', [('I2')])
$offEmbeddedCode s
$if errorFree $abort 'Error expected'
$clearErrors

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.FILTERED)
$offEmbeddedCode s
$if not errorFree $abort 'No error expected'
$ifE card(s)<>0 $abort 'Expected empty s'

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.DEFAULT)
$offEmbeddedCode s
$if errorFree $abort 'Error expected'
$clearErrors

$onEmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.CHECKED)
$offEmbeddedCode s
$if errorFree $abort 'Error expected'
$clearErrors

option clear=s;
EmbeddedCode Python:
  gams.set('s', [('I2')])
endEmbeddedCode s
if (execError, abort 'No error expected');
abort$card(s) 's should be empty',s;

EmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.DEFAULT)
endEmbeddedCode s
if (execError, abort 'No error expected');
abort$card(s) 's should be empty',s;

EmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.FILTERED)
endEmbeddedCode s
if (execError, abort 'No error expected');
abort$card(s) 's should be empty',s;

EmbeddedCode Python:
  gams.set('s', [('I2')], domCheck=DomainCheckType.CHECKED)
endEmbeddedCode s
if (not execError, abort 'Error expected');
execError = 0;

* This should be just empty but not cause a problem
Display s;