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]
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]
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]
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]
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)
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)
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)
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
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]
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]
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)
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)
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]