File: py-ert-execute-region-test.el

package info (click to toggle)
python-mode 1%3A6.2.3-1.1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,032 kB
  • sloc: lisp: 28,389; python: 781; sh: 72; makefile: 43
file content (97 lines) | stat: -rw-r--r-- 3,065 bytes parent folder | download | duplicates (2)
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
;;; py-ert-execute-region-test.el --- py-execute-region tests

;; Copyright (C) 2015  Andreas Röhler
;; Author: Andreas Röhler <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/>.

;;; Commentary:

;; This file is generated by function from python-mode-utils.el - see in
;; directory devel. Edits here might not be persistent.

;;; Code:

(ert-deftest py-ert-execute-region-python-test ()
  (let ((buffer (py--choose-buffer-name "python")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-python (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))

(ert-deftest py-ert-execute-region-python2-test ()
  (let ((buffer (py--choose-buffer-name "python2")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-python2 (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))

(ert-deftest py-ert-execute-region-python3-test ()
  (let ((buffer (py--choose-buffer-name "python3")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-python3 (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))

(ert-deftest py-ert-execute-region-ipython-test ()
  (let ((buffer (py--choose-buffer-name "ipython")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-ipython (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))

(ert-deftest py-ert-execute-region-ipython3-test ()
  (let ((buffer (py--choose-buffer-name "ipython3")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-ipython3 (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))

(ert-deftest py-ert-execute-region-jython-test ()
  (let ((buffer (py--choose-buffer-name "jython")))
    (py-test-with-temp-buffer
        "
    print(\"one\")
    print(\"two\")"
      (py-execute-region-jython (point-min) (point-max))
      (sit-for 0.5 t)
      (set-buffer buffer)
      (should (search-backward "two")))))



(provide 'py-ert-execute-region-test)
;;; py-ert-execute-region-test.el here