def test_5(self): """test execution of sections, report, readmap for a static model""" myModel = mcTestModels.staticModel() statFrw = sf.StaticFramework(myModel) mcFw = mf.MonteCarloFramework(statFrw, 5) mcFw.setQuiet(True) mcFw.run() filesInitialCreated = True filesPremcCreated = True filesPostmcCreated = True for sample in range(1, 6): nameInit = "mcsi%d.map" % (sample) namePre = "premc%d.map" % (sample) namePost = "postmc%d.map" % (sample) if not os.path.isfile(os.path.join(str(sample), nameInit)): filesInitialCreated = False if not os.path.isfile(namePre): filesPremcCreated = False if not os.path.isfile(namePost): filesPostmcCreated = False self.assertTrue(filesInitialCreated) self.assertTrue(filesPremcCreated) self.assertTrue(filesPostmcCreated)
def test_4(self): """test generation of sample directories""" myModel = mcTestModels.staticModel() statFrw = sf.StaticFramework(myModel) mcFw = mf.MonteCarloFramework(statFrw, 5) directoriesCreated = True for directory in range(1, 6): if not os.path.isdir(str(directory)): directoriesCreated = False self.assertTrue(directoriesCreated) for directory in range(1, 6): shutil.rmtree(str(directory)) myModel = mcTestModels.dynamicModel() dynFrw = df.DynamicFramework(myModel, 10) mcFw = mf.MonteCarloFramework(dynFrw, 5) directoriesCreated = True for directory in range(1, 6): if not os.path.isdir(str(directory)): directoriesCreated = False self.assertTrue(directoriesCreated) for directory in range(1, 6): shutil.rmtree(str(directory))
def test_5(self): """test execution of sections, report, readmap for a static model""" myModel = mcTestModels.staticModel() statFrw = sf.StaticFramework(myModel) mcFw = mf.MonteCarloFramework(statFrw, 5) mcFw.setQuiet(True) mcFw.run() filesInitialCreated = True filesPremcCreated = True filesPostmcCreated = True for sample in range(1,6): nameInit = "mcsi%d.map" % (sample) namePre = "premc%d.map" % (sample) namePost ="postmc%d.map" % (sample) if not os.path.isfile(os.path.join(str(sample), nameInit)): filesInitialCreated = False if not os.path.isfile(namePre): filesPremcCreated = False if not os.path.isfile(namePost): filesPostmcCreated = False self.assertTrue(filesInitialCreated) self.assertTrue(filesPremcCreated) self.assertTrue(filesPostmcCreated)
def test_4(self): """test generation of sample directories""" myModel = mcTestModels.staticModel() statFrw = sf.StaticFramework(myModel) mcFw = mf.MonteCarloFramework(statFrw, 5) directoriesCreated = True for directory in range(1,6): if not os.path.isdir(str(directory)): directoriesCreated = False self.assertTrue(directoriesCreated) for directory in range(1,6): shutil.rmtree(str(directory)) myModel = mcTestModels.dynamicModel() dynFrw = df.DynamicFramework(myModel, 10) mcFw = mf.MonteCarloFramework(dynFrw, 5) directoriesCreated = True for directory in range(1,6): if not os.path.isdir(str(directory)): directoriesCreated = False self.assertTrue(directoriesCreated) for directory in range(1,6): shutil.rmtree(str(directory))
def test_2(self): """test existence of added methods and attributes""" myModel = mcTestModels.staticModel() statFrw = sf.StaticFramework(myModel) mcFw = mf.MonteCarloFramework(statFrw, 5) self.assertTrue(hasattr(myModel, "nrSamples")) self.assertTrue(hasattr(myModel, "_d_firstSampleNumber")) self.assertTrue(hasattr(myModel, "_d_lastSampleNumber")) self.assertTrue(hasattr(myModel, "_d_currentSampleNumber")) self.assertTrue(hasattr(myModel, "_d_inSample")) self.assertTrue(hasattr(myModel, "currentSampleNumber")) self.assertTrue(hasattr(myModel, "_lastSampleNumber")) self.assertTrue(hasattr(myModel, "_firstSampleNumber")) self.assertTrue(hasattr(myModel, "_setCurrentSample")) self.assertTrue(hasattr(myModel, "_inSample")) self.assertTrue(hasattr(myModel, "sampleNumbers")) self.assertTrue(hasattr(myModel, "report")) self.assertTrue(hasattr(myModel, "readmap"), "todo")