aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorkobarity2022-10-12 13:14:33 +0200
committerLars Ingebrigtsen2022-10-12 13:14:33 +0200
commitaa559c15537a59147bb01617b4a1f9eee20af3a1 (patch)
tree0de92d6d2764117965419112246cc4f6d2e15bde /test/lisp/progmodes/python-tests.el
parent2953d89d74ebfe6a6bcbe0d25a60a845acad0e13 (diff)
downloademacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.tar.gz
emacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.zip
Fix Python completion when point in shell buffer is before prompt
* lisp/progmodes/python.el (python-shell-completion-at-point): Limit prompt boundaries check to shell buffer. * test/lisp/progmodes/python-tests.el (python-shell-completion-2): (python-shell-completion-native-2): New tests (bug#58441).
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 60ff9bb613a..9ad2d169308 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -4411,6 +4411,22 @@ import abc
4411 (insert "A") 4411 (insert "A")
4412 (should (completion-at-point))))) 4412 (should (completion-at-point)))))
4413 4413
4414(ert-deftest python-shell-completion-2 ()
4415 "Should work regardless of the point in the Shell buffer."
4416 (skip-unless (executable-find python-tests-shell-interpreter))
4417 (python-tests-with-temp-buffer-with-shell
4418 "
4419import abc
4420"
4421 (let ((inhibit-message t))
4422 (python-shell-send-buffer)
4423 (python-tests-shell-wait-for-prompt)
4424 (python-shell-with-shell-buffer
4425 (goto-char (point-min)))
4426 (goto-char (point-max))
4427 (insert "abc.")
4428 (should (completion-at-point)))))
4429
4414(ert-deftest python-shell-completion-native-1 () 4430(ert-deftest python-shell-completion-native-1 ()
4415 (skip-unless (executable-find python-tests-shell-interpreter)) 4431 (skip-unless (executable-find python-tests-shell-interpreter))
4416 (python-tests-with-temp-buffer-with-shell 4432 (python-tests-with-temp-buffer-with-shell
@@ -4427,6 +4443,23 @@ import abc
4427 (insert "A") 4443 (insert "A")
4428 (should (completion-at-point))))) 4444 (should (completion-at-point)))))
4429 4445
4446(ert-deftest python-shell-completion-native-2 ()
4447 "Should work regardless of the point in the Shell buffer."
4448 (skip-unless (executable-find python-tests-shell-interpreter))
4449 (python-tests-with-temp-buffer-with-shell
4450 "
4451import abc
4452"
4453 (let ((inhibit-message t))
4454 (python-shell-completion-native-turn-on)
4455 (python-shell-send-buffer)
4456 (python-tests-shell-wait-for-prompt)
4457 (python-shell-with-shell-buffer
4458 (goto-char (point-min)))
4459 (goto-char (point-max))
4460 (insert "abc.")
4461 (should (completion-at-point)))))
4462
4430(ert-deftest python-shell-completion-native-with-ffap-1 () 4463(ert-deftest python-shell-completion-native-with-ffap-1 ()
4431 (skip-unless (executable-find python-tests-shell-interpreter)) 4464 (skip-unless (executable-find python-tests-shell-interpreter))
4432 (python-tests-with-temp-buffer-with-shell 4465 (python-tests-with-temp-buffer-with-shell