def test_set_raises_KeyError_with_unknown_parameter(self): mock = MockProcessModel({}) pm = data.ProcessModel(mock) try: pm['NotExisting'] = 1 self.fail("Should throw exception") except KeyError as e: self.assertEquals(e.args[0], 'NotExisting')
def test_set_sets_parameter_value(self): params = {'1': 0, '2': 1, '3': 2} mock = MockProcessModel(params) pm = data.ProcessModel(mock) changes = {'1': 0.1, '2': 1.2, '3': 2.3} for change in changes: pm[change] = changes[change] self.assertDictEqual(params, changes)
def test_constructor_accepts_data_processmodel(self): core_pm = core.ProcessModel.create("LimbBudModel") assign = data.ProcessModel(core_pm) organism = data.Organism.create_default(processmodel=assign) assert assign is organism.processmodel
def test_real_contains_core_processmodel(self): mock = "ProcessModel" pm = data.ProcessModel(mock) self.assertIs(pm.real, mock)
def test_name_contains_processmodel_name(self): mock = MockProcessModel(None, "Cheeze") pm = data.ProcessModel(mock) self.assertEquals(pm.name, "Cheeze")
def test_set_raises_TypeError_with_non_double_parameter(self): mock = MockProcessModel({'1': 0}) pm = data.ProcessModel(mock) with self.assertRaises(ValueError): pm['1'] = "str"
def test_get_parameter_returns_value(self): params = {'1': 0, '2': 1, '3': 2} mock = MockProcessModel(params) pm = data.ProcessModel(mock) for key in params: self.assertEquals(pm[key], params[key])
def setup_pm(self, param): mock = MockProcessModel(param) return mock, data.ProcessModel(mock)