def test_that_a_range_of_one_week_gives_us_seven_days(self): range = DAY.range(d_tz(2013, 4, 3), d_tz(2013, 4, 10)) assert_that(list(range), contains( (d_tz(2013, 4, 3), d_tz(2013, 4, 4)), (d_tz(2013, 4, 4), d_tz(2013, 4, 5)), (d_tz(2013, 4, 5), d_tz(2013, 4, 6)), (d_tz(2013, 4, 6), d_tz(2013, 4, 7)), (d_tz(2013, 4, 7), d_tz(2013, 4, 8)), (d_tz(2013, 4, 8), d_tz(2013, 4, 9)), (d_tz(2013, 4, 9), d_tz(2013, 4, 10)) ))
def test_that_beginning_of_the_day_is_a_valid_start_at(self): lovely_starttime = d(2013, 10, 18, 00, 00) assert_that(DAY.valid_start_at(lovely_starttime), is_(True))
def test_that_end_of_the_day_is_the_beginning_of_the_next_day(self): late_in_the_day = d(2013, 10, 18, 21, 00) assert_that(DAY.end(late_in_the_day), is_(d(2013, 10, 19, 00, 00)))
def test_that_midday_is_not_a_valid_start_at(self): naughty_starttime = d(2013, 10, 18, 12, 00) assert_that(DAY.valid_start_at(naughty_starttime), is_(False))
def test_that_returns_the_beginning_of_the_current_day(self): some_datetime = d(2013, 10, 4, 10, 23, 43) start = DAY.start(some_datetime) assert_that(start, is_(d(2013, 10, 4, 0, 0, 0)))
def test_start_of_day_plus_hour_is_invalid(self): assert_that(DAY.valid_start_at(d(2013, 10, 18, 1, 0, 0)), is_(False))
def test_start_of_day_plus_second_is_invalid(self): assert_that(DAY.valid_start_at(d(2013, 10, 18, 0, 0, 1)), is_(False))
def test_start_of_day_is_valid(self): assert_that(DAY.valid_start_at(d(2013, 10, 18, 0, 0, 0)), is_(True))