mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00

Say `Contents API 5.7.4` instead of `Notebook v5` in notebooklist. EIN doesn't care about the python version (2.7, 3.5) or the ipython version (5.8.0, 6.2.1). The "jupyter notebook contents api" version (currently at 5.7.4) is the thing that matters.
28 lines
1.2 KiB
EmacsLisp
28 lines
1.2 KiB
EmacsLisp
(require 'ein-notebooklist)
|
||
(require 'ein-testing-notebook)
|
||
|
||
(defun eintest:notebooklist-make-empty (&optional url-or-port)
|
||
"Make empty notebook list buffer."
|
||
(cl-letf (((symbol-function 'ein:need-kernelspecs) #'ignore)
|
||
((symbol-function 'ein:content-query-sessions) #'ignore))
|
||
(ein:notebooklist-open--finish (or url-or-port ein:testing-notebook-dummy-url) nil
|
||
(make-ein:$content :url-or-port (or url-or-port ein:testing-notebook-dummy-url)
|
||
:notebook-version "5.7.0"
|
||
:path ""))))
|
||
|
||
(defmacro eintest:notebooklist-is-empty-context-of (func)
|
||
`(ert-deftest ,(intern (format "%s--notebooklist" func)) ()
|
||
(with-current-buffer (eintest:notebooklist-make-empty)
|
||
(should-not (,func)))))
|
||
|
||
|
||
;; Generic getter
|
||
|
||
(ert-deftest ein:get-url-or-port--notebooklist ()
|
||
(with-current-buffer (eintest:notebooklist-make-empty)
|
||
(should (equal (ein:get-url-or-port) ein:testing-notebook-dummy-url))))
|
||
|
||
(eintest:notebooklist-is-empty-context-of ein:get-notebook)
|
||
(eintest:notebooklist-is-empty-context-of ein:get-kernel)
|
||
(eintest:notebooklist-is-empty-context-of ein:get-cell-at-point)
|
||
(eintest:notebooklist-is-empty-context-of ein:get-traceback-data)
|