예제 #1
0
    def test_end_year(self, mock_heading, mock_print):
        mock_model = Mock()
        mock_model.total_saved.return_value = Decimal('1500')

        UI.end_year(mock_model, year=3)

        mock_heading.assert_called_once_with('END OF YEAR 3', level=2)
        mock_print.assert_any_call('Total saved to date: £1500')
예제 #2
0
    def _step_forward(self):
        if (self.month % 12) == 1:
            self.model.begin_year()

        self.model.simulate_month()
        if self._achieved_goal():
            return True

        if (self.month % 12) == 0:
            self.model.end_year()
            UI.end_year(self.model, self.month // 12)
        else:
            if self.model.updated:
                self.model.strategise()

        return False