mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Rename jupyter-completion-floating-point-p
to jupyter-completion-number-p
* Add tests for `jupyter-completion-number-p` * Simplify functions that use `jupyter-completion-number-p`
This commit is contained in:
parent
2492ce3143
commit
f13f18b12b
2 changed files with 25 additions and 6 deletions
|
@ -1550,12 +1550,13 @@ begiining of the symbol at point to look for a match of RE."
|
|||
(cons symbol t)
|
||||
symbol)))))
|
||||
|
||||
(defun jupyter-completion-floating-point-p ()
|
||||
"Return non-nil if the text before `point' may be a floating point number.
|
||||
If the preceeding two characters before point are \"[0-9].\"
|
||||
return non-nil, otherwise return nil."
|
||||
(and (= (char-before (point)) ?.)
|
||||
(<= ?0 (char-before (1- (point))) ?9)))
|
||||
(defun jupyter-completion-number-p ()
|
||||
"Return non-nil if the text before `point' may be a floating point number."
|
||||
(and (or (<= ?0 (char-before (point)) ?9)
|
||||
(eq (char-before (point)) ?.))
|
||||
(save-excursion
|
||||
(skip-syntax-backward "w.")
|
||||
(looking-at-p "[0-9]+\\.?[0-9]*"))))
|
||||
|
||||
;;; Extracting arguments from argument strings
|
||||
|
||||
|
|
|
@ -493,6 +493,24 @@ running BODY."
|
|||
(should (json-plist-p res))
|
||||
(should (eq (jupyter-message-type res) :shutdown-reply))))))
|
||||
|
||||
(ert-deftest jupyter-completion ()
|
||||
(ert-info ("`jupyter-completion-number-p'")
|
||||
(with-temp-buffer
|
||||
(insert "0.311")
|
||||
(should (jupyter-completion-number-p))
|
||||
(erase-buffer)
|
||||
(insert "0311")
|
||||
(should (jupyter-completion-number-p))
|
||||
(erase-buffer)
|
||||
(insert "0311.")
|
||||
(should (jupyter-completion-number-p))
|
||||
(erase-buffer)
|
||||
(insert "100foo")
|
||||
(should-not (jupyter-completion-number-p))
|
||||
(erase-buffer)
|
||||
(insert "foo100")
|
||||
(should-not (jupyter-completion-number-p)))))
|
||||
|
||||
(ert-deftest jupyter-repl ()
|
||||
(jupyter-with-python-repl client
|
||||
(should (jupyter-repl-client-has-manager-p))
|
||||
|
|
Loading…
Add table
Reference in a new issue