Ejemplo n.º 1
0
 def test_print_state_print_correctly_when_is_end_true(self, mock_print):
     mass = MassSimulator()
     mass.config = {
         "title": "mass simulation test",
         "currency": "ETH",
         "description": "unit test config",
         "budget": 5000000,
         "strategy": "show me the money",
         "period_list": [{
             "start": "today",
             "end": "tomorrow"
         }],
     }
     mass.analyzed_result = (123.45, 456, 789, 10)
     mass.start = mass.last_print = datetime.now() - timedelta(seconds=4)
     mass.print_state(is_end=True)
     self.assertEqual(
         mock_print.call_args_list[0][0][0].find("simulation completed"),
         36)
     self.assertEqual(mock_print.call_args_list[2][0][0],
                      "수익률 평균:   123.45")
     self.assertEqual(mock_print.call_args_list[3][0][0],
                      "수익률 편차:      456")
     self.assertEqual(mock_print.call_args_list[4][0][0],
                      "수익률 최대:      789")
     self.assertEqual(mock_print.call_args_list[5][0][0],
                      "수익률 최소:       10")
Ejemplo n.º 2
0
 def test_print_state_print_correctly_when_is_start_true(self, mock_print):
     mass = MassSimulator()
     mass.config = {
         "title": "mass simulation test",
         "currency": "ETH",
         "description": "unit test config",
         "budget": 5000000,
         "strategy": "show me the money",
         "period_list": [{
             "start": "today",
             "end": "tomorrow"
         }],
     }
     mass.print_state(is_start=True)
     self.assertEqual(mock_print.call_args_list[1][0][0],
                      "Title: mass simulation test, Currency: ETH")
     self.assertEqual(mock_print.call_args_list[2][0][0],
                      "Description: unit test config")
     self.assertEqual(mock_print.call_args_list[3][0][0],
                      "Budget: 5000000, Strategy: show me the money")
     self.assertEqual(mock_print.call_args_list[4][0][0],
                      "today ~ tomorrow (1)")
     self.assertEqual(
         mock_print.call_args_list[6][0][0].find(
             "+0          simulation start!"), 24)