@@ -104,7 +104,8 @@ def handle_all_events(
104
104
105
105
106
106
handle_events_narrow_console = partial (
107
- handle_all_events , prepare_console = partial (prepare_mock_console , width = 10 )
107
+ handle_all_events ,
108
+ prepare_console = partial (prepare_mock_console , width = 10 ),
108
109
)
109
110
110
111
@@ -936,21 +937,31 @@ def test_setpos_fromxy_in_wrapped_line(self):
936
937
def unix_console (events , ** kwargs ):
937
938
console = UnixConsole ()
938
939
console .get_event = MagicMock (side_effect = events )
940
+
941
+ height = kwargs .get ("height" , 25 )
942
+ width = kwargs .get ("width" , 80 )
943
+ console .getheightwidth = MagicMock (side_effect = lambda : (height , width ))
944
+
939
945
console .prepare ()
940
946
for key , val in kwargs .items ():
941
947
setattr (console , key , val )
942
948
return console
943
949
944
950
945
- handle_events_unix_console = partial (handle_all_events , prepare_console = unix_console )
951
+ handle_events_unix_console = partial (
952
+ handle_all_events ,
953
+ prepare_console = partial (unix_console ),
954
+ )
946
955
handle_events_narrow_unix_console = partial (
947
- handle_all_events , prepare_console = partial (unix_console , width = 5 )
956
+ handle_all_events ,
957
+ prepare_console = partial (unix_console , width = 5 ),
948
958
)
949
959
handle_events_short_unix_console = partial (
950
- handle_all_events , prepare_console = partial (unix_console , height = 1 )
960
+ handle_all_events ,
961
+ prepare_console = partial (unix_console , height = 1 ),
951
962
)
952
963
handle_events_unix_console_height_3 = partial (
953
- handle_all_events , prepare_console = partial (unix_console , height = 2 )
964
+ handle_all_events , prepare_console = partial (unix_console , height = 3 )
954
965
)
955
966
956
967
@@ -1152,6 +1163,7 @@ def test_resize_bigger_on_multiline_function(self, _os_write):
1152
1163
reader , console = handle_events_short_unix_console (events )
1153
1164
1154
1165
console .height = 2
1166
+ console .getheightwidth = MagicMock (lambda _ : (2 , 80 ))
1155
1167
1156
1168
def same_reader (_ ):
1157
1169
return reader
@@ -1185,6 +1197,7 @@ def test_resize_smaller_on_multiline_function(self, _os_write):
1185
1197
reader , console = handle_events_unix_console_height_3 (events )
1186
1198
1187
1199
console .height = 1
1200
+ console .getheightwidth = MagicMock (lambda _ : (1 , 80 ))
1188
1201
1189
1202
def same_reader (_ ):
1190
1203
return reader
0 commit comments