Skip to content

Commit

Permalink
Updated opt controller test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClerx committed Dec 7, 2021
1 parent 0ea3c63 commit 4165b6e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pints/tests/test_opt_optimisation_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ def test_post_run_statistics(self):
opt.set_log_to_screen(False)
opt.set_max_unchanged_iterations(50, 1e-11)

np.random.seed(123)

# Before run methods return None
self.assertIsNone(opt.iterations())
self.assertIsNone(opt.evaluations())
Expand All @@ -426,8 +424,8 @@ def test_post_run_statistics(self):
opt.run()
t_upper = t.time()

self.assertEqual(opt.iterations(), 75)
self.assertEqual(opt.evaluations(), 450)
self.assertEqual(opt.iterations(), 84)
self.assertEqual(opt.evaluations(), 495)

# Time after run is greater than zero
self.assertIsInstance(opt.time(), float)
Expand All @@ -446,9 +444,8 @@ def test_exception_on_multi_use(self):
opt.set_max_unchanged_iterations(None)
opt.set_max_iterations(10)
opt.run()
with self.assertRaisesRegex(RuntimeError,
"Controller is valid for single use only"):
opt.run()
self.assertRaisesRegex(
RuntimeError, 'Controller is valid for single use only', opt.run)


if __name__ == '__main__':
Expand Down

0 comments on commit 4165b6e

Please sign in to comment.