Skip to content

Commit c531530

Browse files
committed
Merge from 5.x: PR #20226
Fixes #20156
2 parents 6935377 + f586c20 commit c531530

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

spyder/plugins/editor/widgets/tests/test_introspection.py

-53
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
# Local imports
2424
from spyder.config.base import running_in_ci, running_in_ci_with_conda
2525
from spyder.config.utils import is_anaconda
26-
from spyder.plugins.completion.api import (
27-
CompletionRequestTypes, CompletionItemKind)
28-
from spyder.plugins.completion.providers.kite.providers.document import (
29-
KITE_COMPLETION)
3026
from spyder.plugins.completion.providers.kite.utils.status import (
3127
check_if_kite_installed, check_if_kite_running)
3228
from spyder.py3compat import PY2
@@ -1068,55 +1064,6 @@ def test_text_snippet_completions(completions_codeeditor, qtbot):
10681064
code_editor.toggle_code_snippets(True)
10691065

10701066

1071-
@pytest.mark.slow
1072-
@pytest.mark.order(1)
1073-
@flaky(max_runs=5)
1074-
def test_kite_textEdit_completions(mock_completions_codeeditor, qtbot):
1075-
"""Test textEdit completions such as those returned by the Kite provider.
1076-
1077-
This mocks out the completions response, and does not test the Kite
1078-
provider directly.
1079-
"""
1080-
code_editor, mock_response = mock_completions_codeeditor
1081-
completion = code_editor.completion_widget
1082-
1083-
code_editor.toggle_automatic_completions(False)
1084-
code_editor.toggle_code_snippets(False)
1085-
1086-
# Set cursor to start
1087-
code_editor.go_to_line(1)
1088-
1089-
qtbot.keyClicks(code_editor, 'my_dict.')
1090-
1091-
# Complete my_dict. -> my_dict["dict-key"]
1092-
mock_response.side_effect = lambda lang, method, params: {'params': [{
1093-
'kind': CompletionItemKind.TEXT,
1094-
'label': '["dict-key"]',
1095-
'textEdit': {
1096-
'newText': '["dict-key"]',
1097-
'range': {
1098-
'start': 7,
1099-
'end': 8,
1100-
},
1101-
},
1102-
'filterText': '',
1103-
'sortText': '',
1104-
'documentation': '',
1105-
'provider': KITE_COMPLETION,
1106-
}]} if method == CompletionRequestTypes.DOCUMENT_COMPLETION else None
1107-
with qtbot.waitSignal(completion.sig_show_completions,
1108-
timeout=10000) as sig:
1109-
qtbot.keyPress(code_editor, Qt.Key_Tab, delay=300)
1110-
mock_response.side_effect = None
1111-
1112-
assert '["dict-key"]' in [x['label'] for x in sig.args[0]]
1113-
qtbot.keyPress(code_editor, Qt.Key_Enter, delay=300)
1114-
assert code_editor.toPlainText() == 'my_dict["dict-key"]\n'
1115-
1116-
code_editor.toggle_automatic_completions(True)
1117-
code_editor.toggle_code_snippets(True)
1118-
1119-
11201067
@pytest.mark.slow
11211068
@pytest.mark.order(1)
11221069
@flaky(max_runs=5)

spyder/widgets/mixins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ def is_special_character(move):
10831083
startpos = cursor.selectionStart()
10841084

10851085
# Find a valid Python variable name
1086-
if valid_python_variable:
1086+
if valid_python_variable and not completion:
10871087
match = re.findall(r'([^\d\W]\w*)', text, re.UNICODE)
10881088
if not match:
10891089
# This is assumed in several places of our codebase,

0 commit comments

Comments
 (0)