コード例 #1
0
 def test__print_trading_result_should_not_print_when_empty_result(
         self, mock_print):
     simulator = Simulator()
     simulator.operator = MagicMock()
     simulator.operator.get_trading_results.return_value = []
     simulator._print_trading_result()
     simulator.operator.get_score.assert_not_called()
コード例 #2
0
 def test__print_trading_result_should_print_result_correctly(
         self, mock_print):
     simulator = Simulator()
     simulator.operator = MagicMock()
     simulator.operator.get_trading_results.return_value = [{
         "date_time": "today",
         "type": "buy",
         "price": 5000,
         "amount": 3,
     }]
     simulator._print_trading_result()
     simulator.operator.get_trading_results.assert_called_once()
     self.assertEqual(mock_print.call_args_list[0][0][0], "@today, buy")
     self.assertEqual(mock_print.call_args_list[1][0][0], "5000 x 3")