def test2_get_config_simulation(self):
        _cfg = Configuration()
        _cfg.read(self.tempf)
        self.assertRaises(ValueError, _cfg.get_config, "simulation")

        self.string2 = re.sub(r"= mode", r"= simulation", self.string2)
        self.write(self.string2, self.tempf)
        _cfg.clear()
        _cfg.read(self.tempf)
        self.assertTrue("path" in _cfg.get_config("simulation"))
    def test3_get_config_properties(self):
        _cfg = Configuration()
        _cfg.read(self.tempf)
        # totalProperties
        self.assertRaises(ValueError, _cfg.get_config, "properties")

        self.string2 = re.sub(r"= total.*", r"= 0", self.string2)
        self.write(self.string2, self.tempf)
        _cfg.clear()
        _cfg.read(self.tempf)
        self.assertRaises(ValueError, _cfg.get_config, "properties")

        more_configs = (r"= 1\n"
                            r"property1Name = \n"
                            r"property1Ref = 1\n")
        self.string2 = re.sub(r"= 0", more_configs, self.string2)
        self.write(self.string2, self.tempf)
        _cfg.clear()
        _cfg.read(self.tempf)
        self.assertEqual([1.0], _cfg.get_config("properties")[2])
Beispiel #3
0
    targetValue = sum([yn.target_function() for yn in y])
    print("Current targeted value:", targetValue)

    return targetValue


if __name__ == "__main__":

    welcome()

    confFile = get_cmd_arg()
    cfg = Configuration()
    cfg.read(confFile)
    #TODO no need a class.

    (optMethod, ) = cfg.get_config("optimization")
    (
        initParaTableFile,
        paraTableFile,
        ffForSimulation,
        ffTemplate,
    ) = cfg.get_config('parameters')
    (
        mode,
        execute,
        path,
        processScript,
    ) = cfg.get_config('simulation')
    (
        totalProperties,
        propertyNames,
 def test1_get_config(self):
     _cfg = Configuration()
     _cfg.read(self.tempf)
     self.assertEqual(["optmethod"], _cfg.get_config("optimization"))
     self.assertTrue("fftemplate" in _cfg.get_config("parameters"))