1 ;;; test-ob-python.el --- tests for ob-python.el
3 ;; Copyright (c) 2011-2012 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
10 (org-test-for-executable "python")
11 (unless (featurep 'ob-python
)
12 (signal 'missing-test-dependency
"Support for Python code blocks"))
14 (ert-deftest test-ob-python
/colnames-yes-header-argument
()
15 (org-test-with-temp-text "#+name: eg
21 #+header: :colnames yes
26 (org-babel-next-src-block)
27 (should (equal '(("col") hline
("a") ("b"))
28 (org-babel-execute-src-block)))))
30 (ert-deftest test-ob-python
/colnames-yes-header-argument-again
()
31 (org-test-with-temp-text "#+tblname: less-cols
37 #+header: :colnames yes
38 #+begin_src python :var tab=less-cols
39 return [[val + '*' for val in row] for row in tab]
41 (org-babel-next-src-block)
42 (should (equal '(("a") hline
("b*") ("c*"))
43 (org-babel-execute-src-block)))))
45 (ert-deftest test-ob-python
/colnames-nil-header-argument
()
46 (org-test-with-temp-text "#+name: eg
52 #+header: :colnames nil
57 (org-babel-next-src-block)
58 (should (equal '(("col") hline
("a") ("b"))
59 (org-babel-execute-src-block)))))
61 (ert-deftest test-ob-python
/colnames-no-header-argument-again
()
62 (org-test-with-temp-text "#+tblname: less-cols
68 #+header: :colnames no
69 #+begin_src python :var tab=less-cols
70 return [[val + '*' for val in row] for row in tab]
72 (org-babel-next-src-block)
73 (should (equal '(("a*") ("b*") ("c*"))
74 (org-babel-execute-src-block)))))
76 (ert-deftest test-ob-python
/colnames-no-header-argument
()
77 (org-test-with-temp-text "#+name: eg
83 #+header: :colnames no
88 (org-babel-next-src-block)
89 (should (equal '(("col") ("a") ("b"))
90 (org-babel-execute-src-block)))))
92 (provide 'test-ob-python
)
94 ;;; test-ob-python.el ends here