File: python-executes-test.el

package info (click to toggle)
python-mode 1%3A6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,440 kB
  • ctags: 3,272
  • sloc: lisp: 32,583; sh: 1,418; python: 757; makefile: 41
file content (123 lines) | stat: -rw-r--r-- 5,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
;;; python-executes-test.el --- executes test
;; Author: Andreas Roehler <andreas.roehler@online.de>
;; Keywords: languages, convenience

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Code:

(defun py-execute-statement-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "print(\"I'm the py-execute-statement-test\")"))
    (py-bug-tests-intern 'py-execute-statement-base arg teststring)))

(defun py-execute-statement-base ()
  (assert (py-execute-statement) nil "py-execute-statement-test failed"))

(defun py-execute-block-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "if True: print(\"I'm the py-execute-block-test\")"))
    (py-bug-tests-intern 'py-execute-block-base arg teststring)))

(defun py-execute-block-base ()
  (assert (py-execute-block) nil "py-execute-block-test failed"))

(defun py-execute-block-or-clause-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "if True: print(\"I'm the py-execute-block-or-clause-test\")"))
    (py-bug-tests-intern 'py-execute-block-or-clause-base arg teststring)))

(defun py-execute-block-or-clause-base ()
  (assert (py-execute-block-or-clause) nil "py-execute-block-or-clause-test failed"))

(defun py-execute-def-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "def foo (): print(\"I'm the py-execute-def-test\")"))
    (py-bug-tests-intern 'py-execute-def-base arg teststring)))

(defun py-execute-def-base ()
  (assert (py-execute-def) nil "py-execute-def-test failed"))

(defun py-execute-class-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "class foo (): print(\"I'm the py-execute-class-test\")"))
    (py-bug-tests-intern 'py-execute-class-base arg teststring)))

(defun py-execute-class-base ()
  (assert (py-execute-class) nil "py-execute-class-test failed"))

(defun py-execute-region-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "print(\"I'm the py-execute-region-test\")"))
    (py-bug-tests-intern 'py-execute-region-base arg teststring)))

(defun py-execute-region-base ()
  (assert (eq nil (py-execute-region (line-beginning-position) (line-end-position))) nil "py-execute-region-test failed"))

(defun py-execute-buffer-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "print(\"I'm the py-execute-buffer-test\")"))
    (py-bug-tests-intern 'py-execute-buffer-test-base arg teststring)))

(defun py-execute-buffer-test-base ()
  (assert (py-execute-buffer) nil "py-execute-buffer-test failed"))

(defun py-execute-expression-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "print(\"I'm the py-execute-expression-test\")"))
    (py-bug-tests-intern 'py-execute-expression-base arg teststring)))

(defun py-execute-expression-base ()
  (assert (py-execute-expression) nil "py-execute-expression-test failed"))

(defun py-execute-line-test (&optional arg load-branch-function)
  (interactive "p")
  (let ((teststring "print(\"I'm the py-execute-line-test\")"))
    (py-bug-tests-intern 'py-execute-line-base arg teststring)))

(defun py-execute-line-base ()
  (assert (py-execute-line) nil "py-execute-line-test failed"))

(defun beginning-of-block-fails-from-wrong-indent-test (&optional arg)
  (interactive "p")
  (let ((teststring "#! /usr/bin/env python
# -*- coding: utf-8 -*-
with file(\"roulette-\" + zeit + \".csv\", 'w') as datei:
 for i in range(anzahl):
        klauf.pylauf()
            datei.write(str(spiel[i]) + \"\\n\")
"))
  (py-bug-tests-intern 'beginning-of-block-fails-from-wrong-indent-base arg teststring)))

(defun beginning-of-block-fails-from-wrong-indent-base ()
    (goto-char 102)
    (assert (eq 48 (py-beginning-of-block)) nil "beginning-of-block-fails-from-wrong-indent-test failed"))

(defun py-execute-file-test (&optional arg)
  (interactive "p")
   (let ((teststring "print(3)"))
  (py-bug-tests-intern 'py-execute-file-intern arg teststring)))

(defun py-execute-file-intern ()
  (let ((py-store-result-p t)
        (file (concat py-temp-directory "/py-execute-file-test.py")))
    (write-file file)
    ;; (sit-for 0.1)
    (unwind-protect
        (setq erg (py-execute-file file))
      (assert (string= "3" erg) nil "py-execute-file-test failed")
      (delete-file file))))

(provide 'python-executes-test)
;;; python-executes-test.el ends here