|
16 | 16 | from .support import prepare_reader as default_prepare_reader |
17 | 17 |
|
18 | 18 | try: |
19 | | - from _pyrepl._module_completer import ModuleCompleter |
20 | 19 | from _pyrepl.console import Event, Console |
21 | | - from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig |
22 | 20 | from _pyrepl.windows_console import ( |
23 | 21 | WindowsConsole, |
24 | 22 | MOVE_LEFT, |
@@ -65,45 +63,6 @@ def handle_events( |
65 | 63 | prepare_reader = prepare_reader or default_prepare_reader |
66 | 64 | return handle_all_events(events, prepare_console, prepare_reader) |
67 | 65 |
|
68 | | - def test_cursor_position_console_width_completion_suggestion(self): |
69 | | - height, width = 25, 80 |
70 | | - config = ReadlineConfig() |
71 | | - namespace = {"interpreter": None, "process": None, "thread": None} |
72 | | - config.module_completer = ModuleCompleter(namespace) |
73 | | - code = "from concurrent.futures import \t\tt\n" |
74 | | - con = WindowsConsole(encoding="utf-8") |
75 | | - con.getheightwidth = MagicMock(return_value=(height, width)) |
76 | | - con.height = height |
77 | | - con.width = width |
78 | | - |
79 | | - def assert_posxy_changed_in_parallel_with_screenxy(method): |
80 | | - def wrapper(y, oldline, newline, px_coord): |
81 | | - newline = newline.ljust(width) |
82 | | - posxy_before = con.posxy |
83 | | - screen_xy_before = con.screen_xy |
84 | | - result = method(y, oldline, newline, px_coord) |
85 | | - posxy_after = con.posxy |
86 | | - screen_xy_after = con.screen_xy |
87 | | - posxy_delta = ( |
88 | | - posxy_after[0] - posxy_before[0], |
89 | | - posxy_after[1] - posxy_before[1],) |
90 | | - screen_xy_delta = ( |
91 | | - screen_xy_after[0] - screen_xy_before[0], |
92 | | - screen_xy_after[1] - screen_xy_before[1],) |
93 | | - self.assertEqual(posxy_delta, screen_xy_delta) |
94 | | - return result |
95 | | - return wrapper |
96 | | - |
97 | | - original_method = con._WindowsConsole__write_changed_line |
98 | | - con._WindowsConsole__write_changed_line = ( |
99 | | - assert_posxy_changed_in_parallel_with_screenxy(original_method) |
100 | | - ) |
101 | | - |
102 | | - for c in code: |
103 | | - con.event_queue.push(bytes(c.encode("utf-8"))) |
104 | | - reader = ReadlineAlikeReader(console=con, config=config) |
105 | | - reader.readline() |
106 | | - |
107 | 66 | def handle_events_narrow(self, events): |
108 | 67 | return self.handle_events(events, width=5) |
109 | 68 |
|
|
0 commit comments