Fix global dynamic variables prefixes in org-mouse.el.
[org-mode/org-mode-NeilSmithlineMods.git] / testing / lisp / test-ob-python.el
blobe2990bc3e7441e087688c383a1835f592f906c1c
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)))
14 load-path)))
15 (require 'org-test)
16 (require 'org-test-ob-consts))
18 (require 'ob-python)
20 (ert-deftest test-ob-python/colnames-yes-header-argument ()
21 (org-test-with-temp-text "#+name: eg
22 | col |
23 |-----|
24 | a |
25 | b |
27 #+header: :colnames yes
28 #+header: :var x = eg
29 #+begin_src python
30 return x
31 #+end_src"
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
38 | a |
39 |---|
40 | b |
41 | c |
43 #+header: :colnames yes
44 #+begin_src python :var tab=less-cols
45 return [[val + '*' for val in row] for row in tab]
46 #+end_src"
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
53 | col |
54 |-----|
55 | a |
56 | b |
58 #+header: :colnames nil
59 #+header: :var x = eg
60 #+begin_src python
61 return x
62 #+end_src"
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
69 | a |
70 |---|
71 | b |
72 | c |
74 #+header: :colnames no
75 #+begin_src python :var tab=less-cols
76 return [[val + '*' for val in row] for row in tab]
77 #+end_src"
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
84 | col |
85 |-----|
86 | a |
87 | b |
89 #+header: :colnames no
90 #+header: :var x = eg
91 #+begin_src python
92 return x
93 #+end_src"
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