1 ;;; test-ob-python.el --- tests for ob-python.el
3 ;; Copyright (c) 2011-2014 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 (org-test-for-executable "python")
23 (unless (featurep 'ob-python
)
24 (signal 'missing-test-dependency
"Support for Python code blocks"))
26 (ert-deftest test-ob-python
/colnames-yes-header-argument
()
27 (org-test-with-temp-text "#+name: eg
33 #+header: :colnames yes
38 (org-babel-next-src-block)
39 (should (equal '(("col") hline
("a") ("b"))
40 (org-babel-execute-src-block)))))
42 (ert-deftest test-ob-python
/colnames-yes-header-argument-again
()
43 (org-test-with-temp-text "#+name: less-cols
49 #+header: :colnames yes
50 #+begin_src python :var tab=less-cols
51 return [[val + '*' for val in row] for row in tab]
53 (org-babel-next-src-block)
54 (should (equal '(("a") hline
("b*") ("c*"))
55 (org-babel-execute-src-block)))))
57 (ert-deftest test-ob-python
/colnames-nil-header-argument
()
58 (org-test-with-temp-text "#+name: eg
64 #+header: :colnames nil
69 (org-babel-next-src-block)
70 (should (equal '(("col") hline
("a") ("b"))
71 (org-babel-execute-src-block)))))
73 (ert-deftest test-ob-python
/colnames-no-header-argument-again
()
74 (org-test-with-temp-text "#+name: less-cols
80 #+header: :colnames no
81 #+begin_src python :var tab=less-cols
82 return [[val + '*' for val in row] for row in tab]
84 (org-babel-next-src-block)
85 (should (equal '(("a*") ("b*") ("c*"))
86 (org-babel-execute-src-block)))))
88 (ert-deftest test-ob-python
/colnames-no-header-argument
()
89 (org-test-with-temp-text "#+name: eg
95 #+header: :colnames no
100 (org-babel-next-src-block)
101 (should (equal '(("col") ("a") ("b"))
102 (org-babel-execute-src-block)))))
104 (provide 'test-ob-python
)
106 ;;; test-ob-python.el ends here