1 ;;; test-ob-python.el --- tests for ob-python.el
3 ;; Copyright (c) 2011 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
9 (org-test-for-executable "python")
11 (let ((load-path (cons (expand-file-name
12 ".." (file-name-directory
13 (or load-file-name buffer-file-name
)))
16 (require 'org-test-ob-consts
))
20 (ert-deftest test-ob-python
/colnames-yes-header-argument
()
21 (org-test-with-temp-text "#+name: eg
27 #+header: :colnames yes
32 (org-babel-next-src-block)
33 (should (equal '(("col") hline
("a") ("b"))
34 (org-babel-execute-src-block)))))
36 (ert-deftest test-ob-python
/colnames-yes-header-argument-again
()
37 (org-test-with-temp-text "#+tblname: less-cols
43 #+header: :colnames yes
44 #+begin_src python :var tab=less-cols
45 return [[val + '*' for val in row] for row in tab]
47 (org-babel-next-src-block)
48 (should (equal '(("a") hline
("b*") ("c*"))
49 (org-babel-execute-src-block)))))
51 (ert-deftest test-ob-python
/colnames-nil-header-argument
()
52 (org-test-with-temp-text "#+name: eg
58 #+header: :colnames nil
63 (org-babel-next-src-block)
64 (should (equal '(("col") hline
("a") ("b"))
65 (org-babel-execute-src-block)))))
67 (ert-deftest test-ob-python
/colnames-no-header-argument-again
()
68 (org-test-with-temp-text "#+tblname: less-cols
74 #+header: :colnames no
75 #+begin_src python :var tab=less-cols
76 return [[val + '*' for val in row] for row in tab]
78 (org-babel-next-src-block)
79 (should (equal '(("a*") ("b*") ("c*"))
80 (org-babel-execute-src-block)))))
82 (ert-deftest test-ob-python
/colnames-no-header-argument
()
83 (org-test-with-temp-text "#+name: eg
89 #+header: :colnames no
94 (org-babel-next-src-block)
95 (should (equal '(("col") ("a") ("b"))
96 (org-babel-execute-src-block)))))
98 (provide 'test-ob-python
)
100 ;;; test-ob-python.el ends here