Пример #1
0
 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')
Пример #2
0
 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)
Пример #3
0
 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
Пример #4
0
 def test_real_contains_core_processmodel(self):
     mock = "ProcessModel"
     pm = data.ProcessModel(mock)
     self.assertIs(pm.real, mock)
Пример #5
0
 def test_name_contains_processmodel_name(self):
     mock = MockProcessModel(None, "Cheeze")
     pm = data.ProcessModel(mock)
     self.assertEquals(pm.name, "Cheeze")
Пример #6
0
 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"
Пример #7
0
 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])
Пример #8
0
 def setup_pm(self, param):
     mock = MockProcessModel(param)
     return mock, data.ProcessModel(mock)