def test_yearly_report_with_invalid_year(df, year): msg = f"<ExceptionInfo ValueError('The year {year} is not included in the report!') tblen=2>" with pytest.raises(ValueError) as e: yearly_report(df, year) assert str(e) == msg
def test_yearly_report(df, capfd, year, expected): yearly_report(df, year) output = capfd.readouterr()[0].split("\n") assert output[9] == expected