Example #1
0
 def test_call_strategy_error_handling(self):
     mock_strategy_check = mock.Mock()
     mock_market = mock.Mock()
     mock_market_book = mock.Mock()
     utils.call_strategy_error_handling(mock_strategy_check, mock_market,
                                        mock_market_book)
     mock_strategy_check.assert_called_with(mock_market, mock_market_book)
Example #2
0
 def test_call_strategy_error_handling_raise(self, mock_config):
     mock_config.raise_errors = True
     mock_strategy_check = mock.MagicMock(side_effect=ValueError)
     mock_strategy_check.__name__ = "mock_strategy_check"
     mock_market = mock.Mock()
     mock_market_book = mock.Mock()
     with self.assertRaises(ValueError):
         utils.call_strategy_error_handling(mock_strategy_check,
                                            mock_market, mock_market_book)
Example #3
0
 def test_call_strategy_error_handling_error(self):
     mock_strategy_check = mock.MagicMock(side_effect=ValueError)
     mock_strategy_check.__name__ = "mock_strategy_check"
     mock_market = mock.Mock()
     mock_market_book = mock.Mock()
     self.assertFalse(
         utils.call_strategy_error_handling(mock_strategy_check,
                                            mock_market, mock_market_book))
     mock_strategy_check.assert_called_with(mock_market, mock_market_book)