Пример #1
0
 def load_model_from_file(f):
     print 'load from %s' % f
     factory = reaction_factories.FileReactionFactory(f)
     model = models.Model(factory)
     return model
Пример #2
0
 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'))
Пример #3
0
 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)
Пример #4
0
 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'))
Пример #5
0
 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'))
Пример #6
0
 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'))
Пример #7
0
 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'))
Пример #8
0
 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)