def load_model_from_file(f): print 'load from %s' % f factory = reaction_factories.FileReactionFactory(f) model = models.Model(factory) return model
def test_no_equations_raises_exception(self): with self.assertRaises( custom_exceptions.MalformattedReactionFileException): reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_6.txt'))
def test_missing_line_ignored(self): f = reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_7.txt')) all_reactions = f.get_reactions() self.assertEqual(len(all_reactions), 2)
def test_negative_simulation_time_raises_exception(self): with self.assertRaises( custom_exceptions.InvalidSimulationTimeException): reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_9.txt'))
def test_non_number_initial_condition_raises_exception(self): with self.assertRaises( custom_exceptions.MalformattedReactionFileException): reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_8.txt'))
def test_negative_initial_condition_raises_exception(self): with self.assertRaises( custom_exceptions.InvalidInitialConditionException): reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_10.txt'))
def test_missing_initial_condition_section(self): with self.assertRaises( custom_exceptions.MissingInitialConditionsException): reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_4.txt'))
def test_missing_time_returns_none(self): f = reaction_factories.FileReactionFactory( os.path.join(this_dir, 'test_model_2.txt')) self.assertEqual(f._simulation_time, None)