Esempio n. 1
0
 def test_set_problem_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._valid_problem_formats = []
     try:
         opt.set_problem_format('a')
     except ValueError:
         pass
     else:
         self.fail("Should not be able to set the problem format undless it's declared as valid.")
     opt._valid_problem_formats = ['a']
     self.assertEqual(opt.results_format(), None)
     opt.set_problem_format('a')
     self.assertEqual(opt.problem_format(), 'a')
     self.assertEqual(opt.results_format(), opt._default_results_format('a'))
Esempio n. 2
0
 def test_set_problem_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._valid_problem_formats = []
     try:
         opt.set_problem_format('a')
     except ValueError:
         pass
     else:
         self.fail("Should not be able to set the problem format undless it's declared as valid.")
     opt._valid_problem_formats = ['a']
     self.assertEqual(opt.results_format(), None)
     opt.set_problem_format('a')
     self.assertEqual(opt.problem_format(), 'a')
     self.assertEqual(opt.results_format(), opt._default_results_format('a'))
Esempio n. 3
0
 def test_set_results_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._valid_problem_formats = ['a']
     opt._valid_results_formats = {'a': 'b'}
     self.assertEqual(opt.problem_format(), None)
     try:
         opt.set_results_format('b')
     except ValueError:
         pass
     else:
         self.fail("Should not be able to set the results format unless it's "\
                   "declared as valid for the current problem format.")
     opt.set_problem_format('a')
     self.assertEqual(opt.problem_format(), 'a')
     opt.set_results_format('b')
     self.assertEqual(opt.results_format(), 'b')
Esempio n. 4
0
 def test_set_results_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._valid_problem_formats = ['a']
     opt._valid_results_formats = {'a':'b'}
     self.assertEqual(opt.problem_format(), None)
     try:
         opt.set_results_format('b')
     except ValueError:
         pass
     else:
         self.fail("Should not be able to set the results format unless it's "\
                   "declared as valid for the current problem format.")
     opt.set_problem_format('a')
     self.assertEqual(opt.problem_format(), 'a')
     opt.set_results_format('b')
     self.assertEqual(opt.results_format(), 'b')
Esempio n. 5
0
 def test_results_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._results_format = 'a'
     self.assertEqual(opt.results_format(), 'a')
     opt._results_format = None
     self.assertEqual(opt.results_format(), None)
Esempio n. 6
0
 def test_results_format(self):
     opt = pyomo.opt.SolverFactory("stest1")
     opt._results_format = 'a'
     self.assertEqual(opt.results_format(), 'a')
     opt._results_format = None
     self.assertEqual(opt.results_format(), None)