##// END OF EJS Templates
created test for reset_search_buffer
Abdullah Habib -
Show More
@@ -12,7 +12,7 b' from IPython.terminal.shortcuts.auto_suggest import ('
12 12 swap_autosuggestion_down,
13 13 )
14 14 from IPython.terminal.shortcuts.auto_match import skip_over
15 from IPython.terminal.shortcuts import create_ipython_shortcuts
15 from IPython.terminal.shortcuts import create_ipython_shortcuts,reset_search_buffer
16 16
17 17 from prompt_toolkit.history import InMemoryHistory
18 18 from prompt_toolkit.buffer import Buffer
@@ -20,6 +20,7 b' from prompt_toolkit.document import Document'
20 20 from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
21 21
22 22 from unittest.mock import patch, Mock
23 from prompt_toolkit.enums import DEFAULT_BUFFER
23 24
24 25
25 26 def test_deprected():
@@ -198,6 +199,24 b' def test_autosuggest_token_empty():'
198 199 assert forward_word.called
199 200
200 201
202 def test_reset_search_buffer():
203 event_with_text = Mock()
204 event_with_text.current_buffer.document.text = "some text"
205 event_with_text.current_buffer.reset = Mock()
206
207 event_empty = Mock()
208 event_empty.current_buffer.document.text = ""
209 event_empty.app.layout.focus = Mock()
210
211 reset_search_buffer(event_with_text)
212 event_with_text.current_buffer.reset.assert_called_once()
213
214 reset_search_buffer(event_empty)
215 event_empty.app.layout.focus.assert_called_once_with(DEFAULT_BUFFER)
216
217
218
219
201 220 def test_other_providers():
202 221 """Ensure that swapping autosuggestions does not break with other providers"""
203 222 provider = AutoSuggestFromHistory()
General Comments 0
You need to be logged in to leave comments. Login now