def test_custom_explanation(self): """ Test that the custom explanation is added to the default explanation. """ now = datetime.datetime.now() start = now - datetime.timedelta(days=10) end = now + datetime.timedelta(days=10) target = DynamicTechnicalDebtTarget(200, start, 100, end, 'Extra.') self.assertEqual( 'Het doel is dat de technische schuld vermindert van {0} op {1} naar {2} op {3}. ' 'De op dit moment geaccepteerde technische schuld is {4}. Extra.'. format(200, format_date(start, year=True), 100, format_date(end, year=True), target.target_value()), target.explanation())
def test_default_explanation(self): """ Test that the default explanation shows the period. """ now = datetime.datetime.now() start = now - datetime.timedelta(days=10) end = now + datetime.timedelta(days=10) target = DynamicTechnicalDebtTarget(200, start, 100, end) self.assertEqual( 'Het doel is dat de technische schuld vermindert van {0} LOC op {1} naar {2} LOC op {3}. ' 'De op dit moment geaccepteerde technische schuld is {4} LOC.'. format(200, format_date(start, year=True), 100, format_date(end, year=True), target.target_value()), target.explanation('LOC'))
def test_date_with_year(self): """ Test that a date time can be formatted with the year included. """ self.assertEqual('19 december 2012', utils.format_date(datetime.datetime(2012, 12, 19), year=True))
def test_missing_date(self): """ Test that None is formatted as missing date. """ self.assertEqual('onbekende datum', utils.format_date(None))
def test_some_date(self): """ Test that a date time is formatted as a day and month. """ self.assertEqual('19 december', utils.format_date(datetime.datetime(2012, 12, 19)))