def test_summary_invalid_end_date(self): with pytest.raises(ValueError): get_stats_summary(start=datetime(2017, 1, 1), end=datetime(2016, 1, 1)) with pytest.raises(ValueError): get_stats_summary(start=datetime(2017, 1, 1), end=datetime(2028, 1, 1))
def test_summary_invalid_start_date(self): with pytest.raises(ValueError): get_stats_summary(start=datetime(2011, 1, 1)) with pytest.raises(ValueError): get_stats_summary(start=datetime(2022, 1, 1))
def test_summary_fails_no_params(self): with pytest.raises(ValueError): get_stats_summary() with pytest.raises(ValueError): get_stats_summary(end=datetime(2017, 1, 1))
def test_summary_pandas(self): df = get_stats_summary(start=datetime(2017, 1, 1), end=datetime(2017, 3, 1), output_format='pandas') assert isinstance(df, DataFrame) assert len(df) == 2
def test_summary_json(self): ls = get_stats_summary(start=datetime(2017, 1, 1), end=datetime(2017, 2, 1)) assert isinstance(ls, list) assert len(ls) == 1