def get_holiday_list(month_days_num: int, first_week_day: int, year: str, month_padded: str) -> list: date_list = [] for i in range(month_days_num): day = i + 1 day_padded = zero_padding(str(day)) week_day = WEEK_DAYS[(first_week_day + i) % 7] date = to_year_month_day(year, month_padded, day_padded) holiday_flg = is_holiday(date) dt = Date(day, week_day, holiday_flg) date_list.append(dt) return date_list
def test_day_normal(self): assert Date(9, '月', False).day == 9
def test_date_without_holiday_flg(self): with pytest.raises(TypeError): assert Date(1, '日')
def test_date_without_day(self): with pytest.raises(TypeError): assert Date('土', True)
def test_date_without_week_day(self): with pytest.raises(TypeError): assert Date(1, False)
def test_date_only_week_day(self): with pytest.raises(TypeError): assert Date('金')
def test_date_only_holiday_flg(self): with pytest.raises(TypeError): assert Date(True)
def test_holiday_flg_none(self): with pytest.raises(TypeError): Date(20, '木', None).holiday_flg
def test_date_no_args(self): with pytest.raises(TypeError): assert Date()
def test_week_day_nonexistent(self): with pytest.raises(NonExistentValueError): assert Date(18, 'あ', False)
def test_holiday_flg_normal(self): assert Date(20, '木', True).holiday_flg is True
def test_week_day_none(self): with pytest.raises(TypeError): assert Date(18, None, False).week_day
def test_week_day_normal(self): assert Date(18, '水', False).week_day == '水'
def test_day_nonexistent(self): with pytest.raises(NonExistentValueError): assert Date(32, '月', False)
def test_day_none(self): with pytest.raises(TypeError): assert Date(None, '月', False)
def test_day_negative(self): with pytest.raises(NonExistentValueError): assert Date(-1, '月', False)