<s> from datetime import date , timedelta <EOL> from freezegun import freeze_time <EOL> from khal . ui . calendarwidget import CalendarWidget <EOL> on_press = { } <EOL> keybindings = { <EOL> '<STR_LIT>' : [ '<STR_LIT:T>' ] , <EOL> '<STR_LIT:left>' : [ '<STR_LIT:left>' , '<STR_LIT:h>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT:k>' ] , <EOL> '<STR_LIT:right>' : [ '<STR_LIT:right>' , '<STR_LIT:l>' , '<STR_LIT:U+0020>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> } <EOL> def test_initial_focus_today ( ) : <EOL> today = date . today ( ) <EOL> frame = CalendarWidget ( on_date_change = lambda _ : None , <EOL> keybindings = keybindings , <EOL> on_press = on_press , <EOL> weeknumbers = '<STR_LIT:right>' ) <EOL> assert frame . focus_date == today <EOL> def test_set_focus_date ( ) : <EOL> today = date . today ( ) <EOL> for diff in range ( - <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:1> ) : <EOL> frame = CalendarWidget ( on_date_change = lambda _ : None , <EOL> keybindings = keybindings , <EOL> on_press = on_press , <EOL> weeknumbers = '<STR_LIT:right>' ) <EOL> day = today + timedelta ( days = diff ) <EOL> frame . set_focus_date ( day ) <EOL> assert frame . focus_date == day <EOL> def test_set_focus_date_weekstart_6 ( ) : <EOL> with freeze_time ( '<STR_LIT>' ) : <EOL> today = date . today ( ) <EOL> for diff in range ( - <NUM_LIT> , <NUM_LIT> , <NUM_LIT:1> ) : <EOL> frame = CalendarWidget ( on_date_change = lambda _ : None , <EOL> keybindings = keybindings , <EOL> on_press = on_press , <EOL> firstweekday = <NUM_LIT:6> , <EOL> weeknumbers = '<STR_LIT:right>' ) <EOL> day = today + timedelta ( days = diff ) <EOL> frame . set_focus_date ( day ) <EOL> assert frame . focus_date == day <EOL> with freeze_time ( '<STR_LIT>' ) : <EOL> today = date . today ( ) <EOL> for diff in range ( <NUM_LIT:10> ) : <EOL> frame = CalendarWidget ( on_date_change = lambda _ : None , <EOL> keybindings = keybindings , <EOL> on_press = on_press , <EOL> firstweekday = <NUM_LIT:6> , <EOL> weeknumbers = '<STR_LIT:right>' ) <EOL> day = today + timedelta ( days = diff ) <EOL> frame . set_focus_date ( day ) <EOL> assert frame . focus_date == day </s>
