Exemple #1
0
    def test_filling_data_for_missing_week_periods(self):
        stub_doc_1 = {"_week_start_at": d(2013, 4, 1), "_count": 5}
        stub_doc_2 = {"_week_start_at": d(2013, 4, 15), "_count": 5}
        period_data = PeriodData([stub_doc_1, stub_doc_2], period="week")

        period_data.fill_missing_periods(d(2013, 4, 1), d(2013, 4, 16))

        assert_that(period_data.data(), has_length(3))
    def test_filling_data_for_missing_month_periods(self):
        stub_doc_1 = {
            "_month_start_at": d(2013, 4, 1),
            "_count": 5

        }
        stub_doc_2 = {
            "_month_start_at": d(2013, 6, 1),
            "_count": 6
        }
        period_data = PeriodData([stub_doc_1, stub_doc_2], period="month")
        period_data.fill_missing_periods(d(2013, 4, 1), d(2013, 6, 2))
        assert_that(period_data.data(), has_length(3))
    def test_filling_data_for_missing_week_periods(self):
        stub_doc_1 = {
            "_week_start_at": d(2013, 4, 1),
            "_count": 5
        }
        stub_doc_2 = {
            "_week_start_at": d(2013, 4, 15),
            "_count": 5
        }
        period_data = PeriodData([stub_doc_1, stub_doc_2], period="week")

        period_data.fill_missing_periods(d(2013, 4, 1), d(2013, 4, 16))

        assert_that(period_data.data(), has_length(3))
Exemple #4
0
 def test_filling_data_for_missing_month_periods(self):
     stub_doc_1 = {"_month_start_at": d(2013, 4, 1), "_count": 5}
     stub_doc_2 = {"_month_start_at": d(2013, 6, 1), "_count": 6}
     period_data = PeriodData([stub_doc_1, stub_doc_2], period="month")
     period_data.fill_missing_periods(d(2013, 4, 1), d(2013, 6, 2))
     assert_that(period_data.data(), has_length(3))