Show More
@@ -11,7 +11,6 b' from IPython.terminal.shortcuts.auto_suggest import (' | |||||
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | from prompt_toolkit.history import InMemoryHistory |
|
13 | from prompt_toolkit.history import InMemoryHistory | |
14 | from prompt_toolkit.shortcuts import PromptSession |
|
|||
15 | from prompt_toolkit.buffer import Buffer |
|
14 | from prompt_toolkit.buffer import Buffer | |
16 |
|
15 | |||
17 | from unittest.mock import patch, Mock |
|
16 | from unittest.mock import patch, Mock | |
@@ -207,18 +206,24 b' async def test_navigable_provider():' | |||||
207 | assert get_suggestion().text == "_a" |
|
206 | assert get_suggestion().text == "_a" | |
208 |
|
207 | |||
209 |
|
208 | |||
|
209 | def create_session_mock(): | |||
|
210 | session = Mock() | |||
|
211 | session.default_buffer = Buffer() | |||
|
212 | return session | |||
|
213 | ||||
|
214 | ||||
210 | def test_navigable_provider_connection(): |
|
215 | def test_navigable_provider_connection(): | |
211 | provider = NavigableAutoSuggestFromHistory() |
|
216 | provider = NavigableAutoSuggestFromHistory() | |
212 | provider.skip_lines = 1 |
|
217 | provider.skip_lines = 1 | |
213 |
|
218 | |||
214 |
session_1 = |
|
219 | session_1 = create_session_mock() | |
215 | provider.connect(session_1) |
|
220 | provider.connect(session_1) | |
216 |
|
221 | |||
217 | assert provider.skip_lines == 1 |
|
222 | assert provider.skip_lines == 1 | |
218 | session_1.default_buffer.on_text_insert.fire() |
|
223 | session_1.default_buffer.on_text_insert.fire() | |
219 | assert provider.skip_lines == 0 |
|
224 | assert provider.skip_lines == 0 | |
220 |
|
225 | |||
221 |
session_2 = |
|
226 | session_2 = create_session_mock() | |
222 | provider.connect(session_2) |
|
227 | provider.connect(session_2) | |
223 | provider.skip_lines = 2 |
|
228 | provider.skip_lines = 2 | |
224 |
|
229 |
General Comments 0
You need to be logged in to leave comments.
Login now