def test_should_get_applicapable_frequency_only_if_given_date_is_a_monthly_deadline( self): deadline = Deadline(frequency=Month(2), mode="Following") self.assertRaises(NotADeadLine, deadline.get_applicable_frequency_period_for, date(2011, 9, 14))
def test_should_return_description_of_monthly_deadline_in_that_mode(self): deadline = Deadline(frequency=Month(2), mode="That") self.assertEqual('2nd of the Month', deadline.description())
def test_should_retun_frequency_period_for_a_given_deadline_when_deadline_frequency_is_month_and_mode_is_that( self): deadline = Deadline(frequency=Month(6), mode="That") self.assertEqual( (date(2011, 9, 1), date(2011, 9, 30)), deadline.get_applicable_frequency_period_for(date(2011, 9, 6)))
def test_should_retun_frequency_period_for_a_given_deadline_when_deadline_frequency_is_month_and_mode_is_following_2( self): deadline = Deadline(frequency=Month(30), mode="Following") self.assertEqual( (date(2011, 7, 1), date(2011, 7, 31)), deadline.get_applicable_frequency_period_for(date(2011, 8, 30)))
def test_should_return_next_deadline_for_monthly_frequency_for_date_on_deadline_for_day31_for_asof_with_30_days( self): month = Month(31) self.assertEqual(date(2011, 9, 30), month.next_deadline_date(date(2011, 9, 3)))
def test_should_return_current_deadline_date_for_that_month_and_asof_post_deadline_day( self): deadline = Deadline(frequency=Month(6), mode="That") self.assertEqual(date(2011, 9, 6), deadline.current(date(2011, 9, 18)))
def _frequency(self): if self.reminder_and_deadline.get('frequency_period') == 'month': return Month(int(self.reminder_and_deadline.get('deadline_month'))) if self.reminder_and_deadline.get('frequency_period') == 'week': return Week(int(self.reminder_and_deadline.get('deadline_week')))
def test_should_return_next_deadline_date_for_following_month_with_asof_after_deadline_day( self): deadline = Deadline(frequency=Month(24), mode="Following") self.assertEqual(date(2011, 10, 24), deadline.next(date(2011, 9, 28)))
def test_should_return_current_deadline_for_monthly_frequency_for_date_on_deadline_for_day31_for_feb_with_29_days( self): month = Month(31) self.assertEqual(date(2012, 2, 29), month.current_deadline_date(date(2012, 3, 3)))
def test_should_return_current_deadline_for_monthly_frequency_for_date_after_deadline( self): month = Month(3) self.assertEqual(date(2011, 9, 3), month.current_deadline_date(date(2011, 9, 9)))
def test_should_return_current_deadline_for_monthly_frequency_for_date_on_deadline_for_day31_for_asof_with_30_days_on_last_day_of_month( self): month = Month(31) self.assertEqual(date(2011, 9, 30), month.current_deadline_date(date(2011, 9, 30)))
def test_should_return_current_deadline_for_monthly_frequency_for_date_on_deadline_for_day31( self): month = Month(31) self.assertEqual(date(2011, 9, 30), month.current_deadline_date(date(2011, 10, 3)))
def test_should_return_next_deadline_for_monthly_frequency_for_date_on_deadline_for_day31_for_feb_with_28_days( self): month = Month(31) self.assertEqual(date(2011, 2, 28), month.next_deadline_date(date(2011, 2, 3)))
def test_should_return_description_of_monthly_deadline_in_following_mode( self): deadline = Deadline(frequency=Month(2), mode="Following") self.assertEqual('2nd of the Following Month', deadline.description())
def test_should_return_current_deadline_date_for_following_month_and_asof_as_deadline_day( self): deadline = Deadline(frequency=Month(6), mode="Following") self.assertEqual(date(2011, 9, 6), deadline.current(date(2011, 9, 6)))
def test_should_return_next_deadline_date_for_following_month_when_current_month_is_december( self): deadline = Deadline(frequency=Month(24), mode="Following") self.assertEqual(date(2014, 1, 24), deadline.next(date(2013, 12, 15)))
def test_should_return_next_deadline_date_for_current_month_and_asof_post_deadline_day( self): deadline = Deadline(frequency=Month(24), mode="That") self.assertEqual(None, deadline.next(date(2011, 9, 30)))
def test_should_return_next_deadline_date_for_current_month(self): deadline = Deadline(frequency=Month(24), mode="That") self.assertEqual(date(2011, 9, 24), deadline.next(date(2011, 9, 15)))
def test_should_return_next_deadline_for_monthly_frequency_for_date_on_deadline( self): month = Month(3) self.assertEqual(date(2011, 10, 3), month.next_deadline_date(date(2011, 9, 3)))