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