def test_should_use_today_if_no_argument_is_given(self):
     d = date.today()
     w = d.weekday()
     assert util.last_working_day() == d if w <= 4 else d - timedelta(w - 4)
 def test_return_should_be_instance_of_date(self):
     assert isinstance(util.last_working_day(), date)
 def test_should_return_date_if_working_day(self):
     d = date(2012, 12, 07)
     assert util.last_working_day(d) == d
 def test_should_return_friday_date_if_date_is_sunday(self):
     assert util.last_working_day(date(2012, 12, 9)) == date(2012, 12, 7)
 def test_should_return_friday_date_if_weekend_and_0_as_arg(self):
     d = date(2012, 12, 16)
     assert util.relative_working_day(0, d) == util.last_working_day(d)
 def test_should_use_today_if_no_argument_is_given(self):
     assert util.relative_working_day(0) == util.last_working_day(
         date.today())
 def test_should_return_date_1_working_day_ago(self):
     dt_today = date.today()
     assert util.relative_working_day(-1) == util.last_working_day(
         util.last_working_day(dt_today) - timedelta(1))
 def test_should_use_config_start_date_til_today_when_no_arg_is_pased(self):
     result = util.range()
     assert result[0].date() == util.next_working_day(config.START_DATE)
     assert result[-1].date() == util.last_working_day()
 def test_should_use_today_date_when_argument_is_not_pased(self):
     result = util.range()
     assert result[-1].date() == util.last_working_day()