Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ob-jupyter.el
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ These parameters are handled internally."
;; :execute-result will be in `jupyter-org-request-results' since
;; stream results and any displayed data will be placed in a separate
;; buffer.
(let ((el (jupyter-org-result
(let ((el (jupyter-org-get-result
req (car (jupyter-org-request-results req)))))
(if (stringp el) el
(org-element-property :value el)))
Expand Down
16 changes: 8 additions & 8 deletions test/jupyter-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2103,20 +2103,20 @@ Image(filename='%s', width=300)" file)
(when (file-exists-p image-file-name)
(delete-file image-file-name)))))

(ert-deftest jupyter-org-result ()
(ert-deftest jupyter-org-get-result ()
:tags '(org)
(let ((req (jupyter-org-request)))
(let ((res (jupyter-org-result req (list :text/plain "foo"))))
(let ((req (jupyter-org-request :marker (jupyter-org-test (point-marker)))))
(let ((res (jupyter-org-get-result req (list :text/plain "foo"))))
(should (eq (org-element-type res) 'fixed-width))
(should (equal (org-element-property :value res) "foo")))
(let ((res (jupyter-org-result req (list :text/html "foo"))))
(let ((res (jupyter-org-get-result req (list :text/html "foo"))))
(should (eq (org-element-type res) 'export-block))
(should (equal (org-element-property :type res) "html"))
(should (equal (org-element-property :value res) "foo\n")))
;; Calls `org-babel-script-escape' for scalar data
(should (equal (jupyter-org-result req (list :text/plain "[1, 2, 3]"))
(should (equal (jupyter-org-get-result req (list :text/plain "[1, 2, 3]"))
"| 1 | 2 | 3 |\n"))
(let ((res (jupyter-org-result req (list :text/plain "[1, 2, 3] Foo"))))
(let ((res (jupyter-org-get-result req (list :text/plain "[1, 2, 3] Foo"))))
(should (eq (org-element-type res) 'fixed-width))
(should (equal (org-element-property :value res) "[1, 2, 3] Foo")))))

Expand All @@ -2141,7 +2141,7 @@ Image(filename='%s', width=300)" file)
;; `org-babel-python-table-or-string', this is more of a test for method
;; order.
(cl-letf* ((py-method-called nil)
(req (jupyter-org-request))
(req (jupyter-org-request :marker (jupyter-org-test (point-marker))))
((symbol-function #'org-babel-python-table-or-string)
(lambda (results)
(setq py-method-called t)
Expand All @@ -2152,7 +2152,7 @@ Image(filename='%s', width=300)" file)
(should (equal (jupyter-kernel-language jupyter-current-client) 'python))
;; Bring in the python specific methods
(jupyter-load-language-support jupyter-current-client)
(should (equal (jupyter-org-result req (list :text/plain "[1, 2, 3]"))
(should (equal (jupyter-org-get-result req (list :text/plain "[1, 2, 3]"))
"| 1 | 2 | 3 |\n"))
(should py-method-called)))

Expand Down