Example #1
0
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
Example #2
0
 def test_day_normal(self):
     assert Date(9, '月', False).day == 9
Example #3
0
 def test_date_without_holiday_flg(self):
     with pytest.raises(TypeError):
         assert Date(1, '日')
Example #4
0
 def test_date_without_day(self):
     with pytest.raises(TypeError):
         assert Date('土', True)
Example #5
0
 def test_date_without_week_day(self):
     with pytest.raises(TypeError):
         assert Date(1, False)
Example #6
0
 def test_date_only_week_day(self):
     with pytest.raises(TypeError):
         assert Date('金')
Example #7
0
 def test_date_only_holiday_flg(self):
     with pytest.raises(TypeError):
         assert Date(True)
Example #8
0
 def test_holiday_flg_none(self):
     with pytest.raises(TypeError):
         Date(20, '木', None).holiday_flg
Example #9
0
 def test_date_no_args(self):
     with pytest.raises(TypeError):
         assert Date()
Example #10
0
 def test_week_day_nonexistent(self):
     with pytest.raises(NonExistentValueError):
         assert Date(18, 'あ', False)
Example #11
0
 def test_holiday_flg_normal(self):
     assert Date(20, '木', True).holiday_flg is True
Example #12
0
 def test_week_day_none(self):
     with pytest.raises(TypeError):
         assert Date(18, None, False).week_day
Example #13
0
 def test_week_day_normal(self):
     assert Date(18, '水', False).week_day == '水'
Example #14
0
 def test_day_nonexistent(self):
     with pytest.raises(NonExistentValueError):
         assert Date(32, '月', False)
Example #15
0
 def test_day_none(self):
     with pytest.raises(TypeError):
         assert Date(None, '月', False)
Example #16
0
 def test_day_negative(self):
     with pytest.raises(NonExistentValueError):
         assert Date(-1, '月', False)