def test_month_offset(date_input, offset, expected): start_date = _to_date(date_input) if expected is None: with pytest.raises(ValueError): month_offset(start_date, offset) else: assert str(month_offset(start_date, offset)) == expected