summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2022-10-12 13:14:33 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-10-12 13:14:33 +0200
commitaa559c15537a59147bb01617b4a1f9eee20af3a1 (patch)
tree0de92d6d2764117965419112246cc4f6d2e15bde /test/lisp/progmodes/python-tests.el
parent2953d89d74ebfe6a6bcbe0d25a60a845acad0e13 (diff)
downloademacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.tar.gz
emacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.tar.bz2
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
(insert "A")
(should (completion-at-point)))))
+(ert-deftest python-shell-completion-2 ()
+ "Should work regardless of the point in the Shell buffer."
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (python-shell-with-shell-buffer
+ (goto-char (point-min)))
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point)))))
+
(ert-deftest python-shell-completion-native-1 ()
(skip-unless (executable-find python-tests-shell-interpreter))
(python-tests-with-temp-buffer-with-shell
@@ -4427,6 +4443,23 @@ import abc
(insert "A")
(should (completion-at-point)))))
+(ert-deftest python-shell-completion-native-2 ()
+ "Should work regardless of the point in the Shell buffer."
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-completion-native-turn-on)
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (python-shell-with-shell-buffer
+ (goto-char (point-min)))
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point)))))
+
(ert-deftest python-shell-completion-native-with-ffap-1 ()
(skip-unless (executable-find python-tests-shell-interpreter))
(python-tests-with-temp-buffer-with-shell