From c715176c0696529031f3c717f42979e68f578227 Mon Sep 17 00:00:00 2001 From: Trevor Murphy Date: Tue, 2 Sep 2025 02:54:36 -0700 Subject: [PATCH 1/2] Use `jupyter-org-get-result` when getting inline source block results. This has been the correct name for the function since c799c25. Also fix the associated unit test. `jupyter-org-request`s must include a non-nil :marker otherwise `jupyter-org-with-point-at` will error. --- ob-jupyter.el | 2 +- test/jupyter-test.el | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ob-jupyter.el b/ob-jupyter.el index 1843d7f9..c7949d40 100644 --- a/ob-jupyter.el +++ b/ob-jupyter.el @@ -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))) diff --git a/test/jupyter-test.el b/test/jupyter-test.el index 99432f96..60d0c134 100644 --- a/test/jupyter-test.el +++ b/test/jupyter-test.el @@ -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"))))) From a59776dbbcc761a87ff3585785917e2898109f64 Mon Sep 17 00:00:00 2001 From: Trevor Murphy Date: Wed, 3 Sep 2025 15:38:43 -0700 Subject: [PATCH 2/2] Fixup Org result test. Previous work exposed a bug where `jupyter-org-result` did not get renamed to `jupyter-org-get-result` and the test fixture `jupyter-org-request` was missing a `:marker` value. This test needs the same fixes. No changes to implementation code. --- test/jupyter-test.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jupyter-test.el b/test/jupyter-test.el index 60d0c134..f9c3ca17 100644 --- a/test/jupyter-test.el +++ b/test/jupyter-test.el @@ -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) @@ -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)))