(buffer-substring-no-properties line-start (point)))
(buffer-substring-no-properties line-start (point))))
(start
- (save-excursion
- (if (not (re-search-backward
- (python-rx
- (or whitespace open-paren close-paren string-delimiter simple-operator))
- line-start
- t 1))
- line-start
- (forward-char (length (match-string-no-properties 0)))
- (point))))
+ (if (< (point) line-start)
+ (point)
+ (save-excursion
+ (if (not (re-search-backward
+ (python-rx
+ (or whitespace open-paren close-paren
+ string-delimiter simple-operator))
+ line-start
+ t 1))
+ line-start
+ (forward-char (length (match-string-no-properties 0)))
+ (point)))))
(end (point))
(prompt-boundaries
(with-current-buffer (process-buffer process)
(python-eldoc-function)
(should (completion-at-point)))))
+(ert-deftest python-shell-completion-shell-buffer-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ ""
+ (python-shell-with-shell-buffer
+ (insert "import abc")
+ (comint-send-input)
+ (python-tests-shell-wait-for-prompt)
+ (insert "abc.")
+ (should (nth 2 (python-shell-completion-at-point)))
+ (end-of-line 0)
+ (should-not (nth 2 (python-shell-completion-at-point))))))
+
+(ert-deftest python-shell-completion-shell-buffer-native-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ ""
+ (python-shell-completion-native-turn-on)
+ (python-shell-with-shell-buffer
+ (insert "import abc")
+ (comint-send-input)
+ (python-tests-shell-wait-for-prompt)
+ (insert "abc.")
+ (should (nth 2 (python-shell-completion-at-point)))
+ (end-of-line 0)
+ (should-not (nth 2 (python-shell-completion-at-point))))))
+
\f
;;; PDB Track integration