Пример #1
0
 def testDaylengthDefaultValue(self):
     """
     Daylength should be 1 if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['daylength'], 1)
Пример #2
0
 def testDaylengthValue(self):
     """
     Daylength is correctly read as an int
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['daylength'], 10)
Пример #3
0
 def testRandomSeedValue(self):
     """
     Randomseed is read correctly
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['randomseed'], '12345678')
Пример #4
0
 def testClearBooksAtEODDefaultValue(self):
     """
     Engines clear books at end of day
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertTrue(params['engines'][0]['clearbooksateod'])
Пример #5
0
 def testWorldClassValue(self):
     """
     World class is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['world']['classname'], 'NullWorld')
Пример #6
0
 def testOrdersLogFileDefaultValue(self):
     """
     OrdersLogFile shoud be None if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['orderslogfilename'], None)
Пример #7
0
 def testOutputfileDefaultValue(self):
     """
     Outputfile should be sys.stdout if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['outputfilename'], 'sys.stdout')
Пример #8
0
 def testRandomseedDefaultValue(self):
     """
     Randomseed should be None if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['randomseed'], None)
Пример #9
0
 def testExperimentNameValue(self):
     """
     Experiment name is correctly read
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['name'], 'Test Experiment')
Пример #10
0
def _get_params(args, opts):
    """
    Get params from conffile
    """
    logger = logging.getLogger('fms')
    simconffile = _get_simconffile(args)
    if os.path.splitext(simconffile)[-1] == '.xml':
        logger.debug("Calling XmlParamsParser on %s" % simconffile)
        params = XmlParamsParser(simconffile)
    else:
        logger.debug("Calling YamlParamsParser on %s" % simconffile)
        params = YamlParamsParser(simconffile)
    params['simconffile'] = simconffile
    params = _apply_opts(params, opts)
    params.printparams()
    return params
Пример #11
0
def _get_params(args, opts):
    """
    Get params from conffile
    """
    logger = logging.getLogger('fms')
    simconffile = _get_simconffile(args)
    if os.path.splitext(simconffile)[-1] == '.xml':
        logger.debug("Calling XmlParamsParser on %s" % simconffile)
        params = XmlParamsParser(simconffile)
    else:
        logger.debug("Calling YamlParamsParser on %s" % simconffile)
        params = YamlParamsParser(simconffile)
    params['simconffile'] = simconffile
    params = _apply_opts(params, opts)
    params.printparams()
    return params
Пример #12
0
 def testMarketClassValue(self):
     """
     Market param classname is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['market']['classname'],
                      'DummyMarket')
Пример #13
0
 def testEngineClassValue(self):
     """
     Engine classname is read correctly
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['engines'][0]['classname'],
                      'AsynchronousRandom')
Пример #14
0
 def testOrderLogFileValue(self):
     """
     OrdersLogFile might be read from config
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['orderslogfilename'],
                      '%s/dummyoutput.log' % self.fixturesdir)
Пример #15
0
 def testOuputfileValue(self):
     """
     Outputfile might be read from config
     """
     xmlparamsfile = '%s/fullconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['outputfilename'],
                      '%s/dummyoutput.csv' % self.fixturesdir)
Пример #16
0
 def testExperimentNameDefaultValue(self):
     """
     Experiment name is built from filename if missing
     """
     xmlparamsfile = '%s/minimalconfig.xml' % self.fixturesdir
     params = XmlParamsParser(xmlparamsfile)
     self.assertEqual(params['name'],
                      '%s/minimalconfig.xml experiment' % self.fixturesdir)