示例#1
0
    def test_that_a_range_of_five_hours_gives_us_five_data_points(self):
        range = HOUR.range(d_tz(2013, 4, 3, 12), d_tz(2013, 4, 3, 17))

        assert_that(list(range), contains(
            (d_tz(2013, 4, 3, 12), d_tz(2013, 4, 3, 13)),
            (d_tz(2013, 4, 3, 13), d_tz(2013, 4, 3, 14)),
            (d_tz(2013, 4, 3, 14), d_tz(2013, 4, 3, 15)),
            (d_tz(2013, 4, 3, 15), d_tz(2013, 4, 3, 16)),
            (d_tz(2013, 4, 3, 16), d_tz(2013, 4, 3, 17))
        ))
示例#2
0
    def test_that_beginning_of_the_hour_is_a_valid_start_at(self):
        beginning_of_the_hour = d(2013, 10, 18, 12, 0)

        assert_that(HOUR.valid_start_at(beginning_of_the_hour), is_(True))
示例#3
0
    def test_that_returns_the_end_of_the_current_hour(self):
        some_datetime = d(2013, 10, 4, 10, 23, 43)

        end = HOUR.end(some_datetime)

        assert_that(end, is_(d(2013, 10, 4, 11, 0, 0)))
示例#4
0
    def test_that_middle_of_the_hour_is_not_a_valid_start_at(self):
        middle_of_the_hour = d(2013, 10, 18, 12, 31)

        assert_that(HOUR.valid_start_at(middle_of_the_hour), is_(False))
示例#5
0
    def test_that_returns_the_beginning_of_the_current_hour(self):
        some_datetime = d(2013, 10, 4, 10, 23, 43)

        start = HOUR.start(some_datetime)

        assert_that(start, is_(d(2013, 10, 4, 10, 0, 0)))
示例#6
0
 def test_start_of_hour_plus_minute_is_invalid(self):
     assert_that(HOUR.valid_start_at(d(2013, 10, 18, 12, 1, 0)), is_(False))
示例#7
0
 def test_start_of_hour_plus_second_is_invalid(self):
     assert_that(HOUR.valid_start_at(d(2013, 10, 18, 12, 0, 1)), is_(False))
示例#8
0
 def test_start_of_hour_is_valid(self):
     assert_that(HOUR.valid_start_at(d(2013, 10, 18, 12, 0, 0)), is_(True))