Skip to content

Commit f2e3e86

Browse files
committed
Mock getheightwidth
1 parent e84f943 commit f2e3e86

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

Lib/test/test_pyrepl.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def handle_all_events(
104104

105105

106106
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(
109+
prepare_mock_console, width=10, getheightwidth=MagicMock(lambda self: (25, 10))
110+
),
108111
)
109112

110113

@@ -942,15 +945,27 @@ def unix_console(events, **kwargs):
942945
return console
943946

944947

945-
handle_events_unix_console = partial(handle_all_events, prepare_console=unix_console)
948+
handle_events_unix_console = partial(
949+
handle_all_events,
950+
prepare_console=partial(unix_console, getheightwidth=MagicMock(25, 80)),
951+
)
946952
handle_events_narrow_unix_console = partial(
947-
handle_all_events, prepare_console=partial(unix_console, width=5)
953+
handle_all_events,
954+
prepare_console=partial(
955+
unix_console, width=5, getheightwidth=MagicMock(lambda self: (25, 5))
956+
),
948957
)
949958
handle_events_short_unix_console = partial(
950-
handle_all_events, prepare_console=partial(unix_console, height=1)
959+
handle_all_events,
960+
prepare_console=partial(
961+
unix_console, height=1, getheightwidth=MagicMock(lambda self: (1, 80))
962+
),
951963
)
952964
handle_events_unix_console_height_3 = partial(
953-
handle_all_events, prepare_console=partial(unix_console, height=2)
965+
handle_all_events,
966+
prepare_console=partial(
967+
unix_console, height=3, getheightwidth=MagicMock(lambda self: (3, 80))
968+
),
954969
)
955970

956971

0 commit comments

Comments
 (0)