emacs-ipython-notebook/test/test-ein-ob.el
dickmao e491ac6f1c Ob-ein Improvements
Bring the org offering to feature parity.
2019-05-20 10:59:43 -04:00

34 lines
940 B
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(eval-when-compile (require 'cl))
(require 'ert)
(require 'ob-ein)
;; Test utils
(ert-deftest ein:ob-anonymous-p ()
(should (ob-ein-anonymous-p ".ein-python.ipynb"))
(should (ob-ein-anonymous-p ".ein.ipynb"))
(should-not (ob-ein-anonymous-p "ein-python.ipynb"))
(should-not (ob-ein-anonymous-p "Untitled.ipynb")))
;;; This is the content portion of a response from the content API.
(defvar eintest:ob-src-block
"#+BEGIN_SRC ein :session 8888/Untitled.ipynb
import sys
a = 14500
b = a+1000
sys.version
#+END_SRC
")
(ert-deftest ein:ob-aware ()
(let ((org-babel-load-languages (quote ((ein . t)))))
(with-temp-buffer
(save-excursion
(org-mode)
(insert eintest:ob-src-block)
(search-backward "SRC")
(cl-letf (((symbol-function 'ob-ein--initiate-session)
(lambda (&rest args) (make-ein:$notebook))))
(should (call-interactively #'org-edit-special)))))))