Пример #1
0
 def test_run_experiment3(self, mock_opt, mock_set):
     mock_db = Mock()
     mock_opt.side_effect = Exception()
     result = run_experiment(mock_db, 2, 3, 4, 5)
     self.assertEqual(result, mock_db.ident)
     mock_set.assert_called_once_with(mock_db)
     mock_opt.assert_called_once_with(mock_db, 2, 3, 4, 5)
Пример #2
0
 def test_run_experiment2(self, mock_opt, mock_set):
     mock_db = Mock()
     mock_opt.side_effect = KeyboardInterrupt()
     result = run_experiment(mock_db, 2, 3, 4, 5)
     self.assertEqual(result, -1)
     mock_set.assert_called_once_with(mock_db)
     mock_opt.assert_called_once_with(mock_db, 2, 3, 4, 5)