Exemplo n.º 1
0
    def test_group_week(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 15)]
        expected_days = [datetime.date(2012, 5, 8)]

        dummies = pad_missing_stats(days, 'week')
        for day in expected_days:
            assert day in [dummy['date'] for dummy in dummies]
Exemplo n.º 2
0
    def test_group_month(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 7, 1)]
        expected_days = [datetime.date(2012, 6, 1)]

        dummies = pad_missing_stats(days, 'month')
        for day in expected_days:
            assert day in [dummy['date'] for dummy in dummies]
Exemplo n.º 3
0
    def test_group_month(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 7, 1)]
        expected_days = [datetime.date(2012, 6, 1)]

        dummies = pad_missing_stats(days, "month")
        for day in expected_days:
            assert day in [dummy["date"] for dummy in dummies]
Exemplo n.º 4
0
    def test_group_week(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 15)]
        expected_days = [datetime.date(2012, 5, 8)]

        dummies = pad_missing_stats(days, "week")
        for day in expected_days:
            assert day in [dummy["date"] for dummy in dummies]
Exemplo n.º 5
0
    def test_group_month(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 7, 1)]
        expected_days = [datetime.date(2012, 6, 1)]

        dummies = pad_missing_stats(days, 'month')
        days = [dummy['date'].date() for dummy in dummies]
        for day in expected_days:
            eq_(day in days, True)
Exemplo n.º 6
0
    def test_group_week(self):
        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 15)]
        expected_days = [datetime.date(2012, 5, 8)]

        dummies = pad_missing_stats(days, 'week')
        days = [dummy['date'].date() for dummy in dummies]
        for day in expected_days:
            eq_(day in days, True)
Exemplo n.º 7
0
    def test_with_fields(self):
        fields = ['test_field', 'fest_tield']

        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 3)]
        dummies = pad_missing_stats(days, 'day', fields=fields)
        for dummy in dummies:
            for field in fields:
                eq_(field in dummy, True)
Exemplo n.º 8
0
    def test_with_fields(self):
        fields = ['test_field', 'fest_tield']

        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 3)]
        dummies = pad_missing_stats(days, 'day', fields=fields)
        for dummy in dummies:
            for field in fields:
                eq_(field in dummy, True)
Exemplo n.º 9
0
    def test_with_fields(self):
        fields = ["test_field", "fest_tield"]

        days = [datetime.date(2012, 5, 1), datetime.date(2012, 5, 3)]
        dummies = pad_missing_stats(days, "day", fields=fields)
        for dummy in dummies:
            for field in fields:
                assert field in dummy
Exemplo n.º 10
0
    def test_with_date_range(self):
        date_range = (datetime.date(2012, 5, 1), datetime.date(2012, 5, 5))

        days = [datetime.date(2012, 5, 3)]
        expected_days = [datetime.date(2012, 5, 2), datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, 'day', date_range=date_range)
        for day in expected_days:
            assert day in [dummy['date'] for dummy in dummies]
Exemplo n.º 11
0
    def test_with_date_range(self):
        date_range = (datetime.date(2012, 5, 1), datetime.date(2012, 5, 5))

        days = [datetime.date(2012, 5, 3)]
        expected_days = [datetime.date(2012, 5, 2), datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, "day", date_range=date_range)
        for day in expected_days:
            assert day in [dummy["date"] for dummy in dummies]
Exemplo n.º 12
0
    def test_with_date_range(self):
        date_range = (datetime.date(2012, 5, 1), datetime.date(2012, 5, 5))

        days = [datetime.date(2012, 5, 3)]
        expected_days = [datetime.date(2012, 5, 2), datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, 'day', date_range=date_range)
        days = [dummy['date'].date() for dummy in dummies]
        for day in expected_days:
            eq_(day in days, True)
Exemplo n.º 13
0
    def test_basic(self):
        days = [datetime.date(2012, 4, 29), datetime.date(2012, 5, 1),
                datetime.date(2012, 5, 3), datetime.date(2012, 5, 5)]
        expected_days = [datetime.date(2012, 4, 30), datetime.date(2012, 5, 2),
                         datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, 'day')
        days = [dummy['date'].date() for dummy in dummies]
        for day in expected_days:
            eq_(day in days, True)
Exemplo n.º 14
0
    def test_basic(self):
        days = [datetime.date(2012, 4, 29), datetime.date(2012, 5, 1),
                datetime.date(2012, 5, 3), datetime.date(2012, 5, 5)]
        expected_days = [datetime.date(2012, 4, 30), datetime.date(2012, 5, 2),
                         datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, 'day')
        days = [dummy['date'].date() for dummy in dummies]
        for day in expected_days:
            eq_(day in days, True)
Exemplo n.º 15
0
    def test_basic(self):
        days = [
            datetime.date(2012, 4, 29),
            datetime.date(2012, 5, 1),
            datetime.date(2012, 5, 3),
            datetime.date(2012, 5, 5),
        ]
        expected_days = [datetime.date(2012, 4, 30), datetime.date(2012, 5, 2), datetime.date(2012, 5, 4)]

        dummies = pad_missing_stats(days, "day")
        for day in expected_days:
            assert day in [dummy["date"] for dummy in dummies]