1
;; py-ert-tests.el --- Tests, some adapted from python.el -*- lexical-binding: t; -*-
3
;; Copyright (C) 2014 Andreas Röhler, <andreas.roehler@online.de>
5
;; GNU Emacs is free software: you can redistribute it and/or modify
6
;; it under the terms of the GNU General Public License as published by
7
;; the Free Software Foundation, either version 3 of the License, or
8
;; (at your option) any later version.
10
;; GNU Emacs is distributed in the hope that it will be useful,
11
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
;; GNU General Public License for more details.
15
;; You should have received a copy of the GNU General Public License
16
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
;; tests are expected to run from directory test
24
(add-to-list 'load-path default-directory)
25
(load "py-ert-tests-1.el" nil t)
27
;; (require 'python-mode-test)
30
(ert-deftest py-ert-keyword-face-lp-1294742 ()
31
(py-test-with-temp-buffer-point-min
32
" and as assert break continue del elif else except exec finally for global if in is lambda not or pass raise return while with yield"
33
(font-lock-fontify-buffer)
34
(while (and (not (eobp))(< 0 (skip-chars-forward " ")))
35
(should (eq 'font-lock-keyword-face (get-char-property (point) 'face)))
36
(skip-chars-forward "^ \n"))))
38
(ert-deftest py-ert-builtins-face-lp-1294742 ()
39
(let ((py-shell-name "python3"))
40
(py-test-with-temp-buffer-point-min
41
"_ __doc__ __import__ __name__ __package__ abs all any apply basestring bin bool buffer bytearray bytes callable chr classmethod cmp coerce compile complex delattr dict dir divmod enumerate eval execfile file filter float format frozenset getattr globals hasattr hash help hex id input int intern isinstance issubclass iter len list locals long map max min next object oct open ord pow print property range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip"
42
(font-lock-fontify-buffer)
43
(when py-debug-p (switch-to-buffer (current-buffer)))
45
;; (when py-debug-p (switch-to-buffer (current-buffer)))
46
(should (eq 'py-builtins-face (get-char-property (point) 'face))))))
48
(ert-deftest py-ert-pseudo-keyword-face-lp-1294742 ()
49
(py-test-with-temp-buffer-point-min
50
" Ellipsis True False None __debug__ NotImplemented"
51
(font-lock-fontify-buffer)
52
(while (and (not (eobp))(< 0 (skip-chars-forward " ")))
53
(should (eq 'py-pseudo-keyword-face (get-char-property (point) 'face)))
54
(skip-chars-forward "^ \n"))))
56
(ert-deftest py-ert-object-reference-face-lp-1294742 ()
57
(py-test-with-temp-buffer-point-min
59
(font-lock-fontify-buffer)
60
(while (and (not (eobp))(< 0 (skip-chars-forward " ")))
61
(should (eq 'py-object-reference-face (get-char-property (point) 'face)))
62
(skip-chars-forward "^ \n"))))
64
(ert-deftest py-ert-borks-all-lp-1294820 ()
65
(py-test-with-temp-buffer-point-min
66
"# M-q within some code (not in= a docstring) completely borks all previous
69
# E.g. here, if I M-q within the last function:
80
# def foo(self): some_actual_code() def bar(self): some_actual_code() def
84
(font-lock-fontify-buffer)
85
(search-forward "def baz(self):")
88
(should (eq (char-after) ?\n))))
90
(ert-deftest py-ert-respect-paragraph-1294829 ()
92
(py-test-with-temp-buffer-point-min
93
"# py-fill-paragraph doesn';t respect existing paragraph breaks when
94
# reflowing the docstring, e.g.
97
\"\"\"First one-line summary.
99
Some other stuff which I don't want a paragraph break inserted into
102
And another para hjkdfgh fdjkg hfdjkg hdfjk ghdfk ghjkdf
103
ghjkdf ghjdf ghjdkf k
107
\"\"\"Second one-line summary. Some other stuff which I don't want a
110
break inserted into the middle of. And another para hjkdfgh
112
hfdjkg hdfjk ghdfk ghjkdf ghjkdf ghjdf ghjdkf k \"\"\"
114
# I feel it would be better if it didn't attempt to
115
# reflow the whole docstring, rather just reflow the
116
# particular paragraph within it which the point is
119
# It would also be good if it could avoid mangling parameter
120
# descriptions like this:
125
Foo bar fhgdjkfd hgjfd hgjkfd ghjkdf ghjkdf hgjdf ghjkdf
126
hgjdf hjgk dfhjkg dfhjkg dfhjkg fdhjkg hjfdkg
131
1-d endogenous response variable. The dependent variable.
133
A nobs x k array where `nobs` is the number of
135
is the number of regressors. An interecept is not
137
and should be added by the user. See
138
`statsmodels.tools.add_constant`.\"\"\"
141
\"\"\"Summary line. Foo bar fhgdjkfdhgjfd hgjkfd ghjkdf ghjkdf
144
ghjkdf hgjdf hjgk dfhjkg dfhjkg dfhjkg fdhjkghjfdkg
146
---------- endog : array-like 1-d endogenous response
148
dependent variable. exog : array-like A nobs x karray where
150
is the number of observations and `k` is the number of
152
An interecept is not included by default and should be added
154
user. See `statsmodels.tools.add_constant`.
157
# Failing that though, if I can at least choose to
158
# reflow individual paragraphs in the docstring and
159
# leave others intact, I can format these things
160
# manually while still being able to flow other
161
# paragraphs using M-q.
163
(when py-debug-p (switch-to-buffer (current-buffer)))
164
(font-lock-fontify-buffer)
165
(search-forward "Some other" nil t 1)
169
(should (not (empty-line-p)))
171
(should (eq (char-after) ?\n))
172
(search-forward "one-line summary." nil t 1)
173
(when py-debug-p (message "fill-column: %s" fill-column))
177
(should (empty-line-p))
178
(search-forward "Foo bar" nil t 1)
181
(should (eq (char-after) ?\n))))
183
(ert-deftest py-ert-backward-same-level-test ()
184
(py-test-with-temp-buffer-point-min
217
(font-lock-fontify-buffer)
219
(py-backward-same-level)
220
(should (looking-at "except"))
221
(py-backward-same-level)
222
(should (looking-at "try"))))
224
(ert-deftest py-ert-up-level-test-2 ()
225
(py-test-with-temp-buffer-point-min
260
(should (looking-at "else:"))))
263
(ert-deftest py-ert-deletes-too-much-lp:1300270 ()
264
(py-test-with-temp-buffer "
268
;; (when py-debug-p (switch-to-buffer (current-buffer)))
271
(should (eq 5 (current-indentation)))))
273
(ert-deftest py-ert-mark-expression-test ()
274
"Avoid infinite loop"
275
(py-test-with-temp-buffer
276
"assert pycompletions('TestClass.test' , name) == \
277
['testclassmeth', 'testmeth', 'testprop', 'teststaticmeth']"
280
(should (eq 119 (mark)))
283
(should (eq 46 (mark)))))
285
(ert-deftest py-dedicated-shell-test ()
287
(let ((erg (py-shell nil t "python")))
288
(should (< 8 (length erg)))
289
(should (eq 0 (string-match "^*Python" erg)))))
291
(ert-deftest py-python-shell-test ()
293
(let ((erg (python)))
294
(should (bufferp (get-buffer erg)))
295
(should (get-buffer-process erg))))
297
(ert-deftest py-python2-shell-test ()
299
(let ((erg (python2)))
300
(should (bufferp (get-buffer erg)))
301
(should (get-buffer-process erg))))
303
(ert-deftest py-python3-shell-test ()
305
(let ((erg (python3)))
306
(should (bufferp (get-buffer erg)))
307
(should (get-buffer-process erg))))
309
(ert-deftest py-keep-windows-configuration-test ()
310
(py-test-with-temp-buffer
311
"print('py-keep-windows-configuration-test-string')"
312
(delete-other-windows)
313
(let ((py-keep-windows-configuration t)
314
(py-split-window-on-execute t)
315
(full-height (window-height)))
316
(py-execute-statement)
317
(should (eq (window-height) full-height)))))
319
(ert-deftest py-compute-indentation-after-import-test ()
320
(py-test-with-temp-buffer
323
(should (eq 0 (py-compute-indentation)))))
325
(ert-deftest py-compute-indentation-bob-test ()
326
(py-test-with-temp-buffer-point-min
334
(should (eq 0 (py-compute-indentation)))))
336
(ert-deftest py-indentation-lp-1375122-test ()
337
(py-test-with-temp-buffer
343
(call-interactively 'py-indent-or-complete)
345
(should (eq 8 (current-column)))
347
(delete-horizontal-space)
349
(call-interactively 'py-indent-or-complete)
351
(should (eq 8 (current-column)))
353
;; (call-interactively 'py-indent-or-complete)
354
;; (call-interactively 'py-indent-or-complete)
356
;; (should (eq 4 (current-column)))
357
;; (py-indent-or-complete)
359
;; (should (eq 8 (current-column)))
362
(ert-deftest py-shell-python-lp-1398530-test ()
363
(when (buffer-live-p (get-buffer "*Python*"))(py-kill-buffer-unconditional "*Python*"))
364
(py-test-with-temp-buffer
366
(when py-debug-p (switch-to-buffer (current-buffer)))
367
(let ((py-shell-name "python"))
370
(should (buffer-live-p (get-buffer "*Python*"))))))
372
(ert-deftest py-shell-python3-lp-1398530-test ()
373
(when (buffer-live-p (get-buffer "*Python3*"))(py-kill-buffer-unconditional "*Python3*"))
374
(py-test-with-temp-buffer
377
(let ((py-shell-name "python3"))
380
(should (buffer-live-p (get-buffer "*Python3*"))))))
382
(ert-deftest py-shell-python2-lp-1398530-test ()
383
(when (buffer-live-p (get-buffer "*Python2*"))(py-kill-buffer-unconditional "*Python2*"))
384
(py-test-with-temp-buffer
386
(when py-debug-p (switch-to-buffer (current-buffer)))
387
(let ((py-shell-name "python2"))
390
(should (buffer-live-p (get-buffer "*Python2*"))))))
392
(ert-deftest py-backward-statement-test-1 ()
393
(py-test-with-temp-buffer
394
(let ((py-return-result-p t)
395
py-result py-store-result-p)
396
"# -*- coding: utf-8 -*-
399
c.hello() #causes error, but emacs tracking fails
400
import sys, os; os.remove('do/something/nasty') # lp:1025000
409
(py-backward-statement)
410
(should (eq (char-after) ?a))
411
(py-backward-statement)
412
(should (eq (char-after) ?d))
413
(py-backward-statement)
414
(should (eq (char-after) ?o))
415
(py-backward-statement)
416
(should (eq (char-after) ?i))
417
(py-backward-statement)
418
(should (eq (char-after) ?c))
419
(py-backward-statement)
420
(should (eq (char-after) ?c))
421
(py-backward-statement)
422
(should (eq (char-after) ?p))
423
(py-backward-statement)
426
(ert-deftest py-ert-backward-except-block-test ()
427
(py-test-with-temp-buffer
429
# -*- coding: utf-8 -*-
434
for a in range(anzahl):
439
(py-backward-except-block)
440
(should (eq (char-after) ?e))))
442
(ert-deftest py-ert-backward-except-block-bol-test ()
443
(py-test-with-temp-buffer
445
# -*- coding: utf-8 -*-
450
for a in range(anzahl):
455
(py-backward-except-block-bol)
456
(should (eq (char-after) ?\ ))))
458
;; (and (bufferp (get-buffer "*Python*"))(buffer-live-p (get-buffer "*Python*"))(py-kill-buffer-unconditional "*Python*"))
459
;; (and (bufferp (get-buffer "*IPython*"))(buffer-live-p (get-buffer "*IPython*"))(py-kill-buffer-unconditional "*IPython*")))
461
(defun nested-dictionaries-indent-lp:328791-test (&optional arg)
462
"With ARG greater 1 keep test buffer open.
464
If no `load-branch-function' is specified, make sure the appropriate branch is loaded. Otherwise default python-mode will be checked. "
501
(py-bug-tests-intern 'nested-dictionaries-indent-lp:328791-base arg teststring)))
503
(ert-deftest py-ert-nested-dictionaries-indent-lp:328791-test ()
504
(py-test-with-temp-buffer-point-min
540
(let ((py-indent-honors-multiline-listing t)
541
py-closing-list-dedents-bos)
542
(search-forward "'a':{")
543
(should (eq 4 (py-compute-indentation)))
545
(should (eq 8 (py-compute-indentation)))
547
(should (eq 4 (py-compute-indentation)))
548
;; py-closing-list-dedents-bos
549
(setq py-closing-list-dedents-bos t)
550
(search-forward "'a':{")
551
(should (eq 4 (py-compute-indentation)))
553
(should (eq 4 (py-compute-indentation)))
555
(should (eq 0 (py-compute-indentation)))
556
(search-forward "}" nil nil 2)
557
(should (eq 12 (py-compute-indentation)))
559
(should (eq 8 (py-compute-indentation)))
561
(should (eq 4 (py-compute-indentation)))
563
(should (eq 0 (py-compute-indentation))))))
565
(ert-deftest py-ert-flexible-indentation-lp-328842-test-1 ()
566
(py-test-with-temp-buffer-point-min
567
"\(long, sequence, of_items,
568
that, needs, to_be, wrapped) = input_list
570
packed_entry = (long, sequence, of_items,
571
that, needs, to_be, wrapped)
573
\( whitespaced, long, sequence, of_items,
574
that, needs, to_be, wrapped) = input_list
576
(let ((py-indent-honors-multiline-listing t))
577
(search-forward "(long")
580
(should (eq nil (get-char-property (point) 'face))))))
582
(ert-deftest py-ert-flexible-indentation-lp-328842-test-2 ()
583
(py-test-with-temp-buffer-point-min
584
"\(long, sequence, of_items,
585
that, needs, to_be, wrapped) = input_list
587
packed_entry = (long, sequence, of_items,
588
that, needs, to_be, wrapped)
590
\( whitespaced, long, sequence, of_items,
591
that, needs, to_be, wrapped) = input_list
593
(let ((py-indent-honors-multiline-listing t)
594
py-indent-paren-spanned-multilines-p)
596
(assert (eq 1 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed")
598
(assert (eq 16 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed")
600
(assert (eq 2 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed"))))
602
(ert-deftest py-ert-flexible-indentation-lp-328842-test-3 ()
603
(py-test-with-temp-buffer-point-min
604
"\(long, sequence, of_items,
605
that, needs, to_be, wrapped) = input_list
607
packed_entry = (long, sequence, of_items,
608
that, needs, to_be, wrapped)
610
\( whitespaced, long, sequence, of_items,
611
that, needs, to_be, wrapped) = input_list
613
(let ((py-indent-honors-multiline-listing t)
614
(py-indent-paren-spanned-multilines-p t))
616
(assert (eq 5 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed")
618
(assert (eq 20 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed")
620
(assert (eq 6 (py-compute-indentation)) nil "flexible-indentation-lp-328842-test failed"))))
622
(ert-deftest py-ert-indent-in-arglist-test ()
623
(py-test-with-temp-buffer
627
(let (py-indent-paren-spanned-multilines-p)
628
(should (eq 9 (py-compute-indentation))))
629
(let ((py-indent-paren-spanned-multilines-p t))
630
(should (eq 13 (py-compute-indentation))))))
632
(ert-deftest py-complete-in-python-shell-test ()
633
(let ((py-shell-name "python")
634
(py-switch-buffers-on-execute-p t))
635
(py-kill-buffer-unconditional "*Python*")
637
(goto-char (point-max))
639
(py-indent-or-complete)
641
(should (eq ?p (char-after)))))
643
(ert-deftest py-complete-in-python3-shell-test ()
644
(let ((py-shell-name "python3")
645
(py-switch-buffers-on-execute-p t))
646
(py-kill-buffer-unconditional "*Python3*")
648
(should (eq (current-buffer) (get-buffer "*Python3*")))
649
(goto-char (point-max))
651
(py-indent-or-complete)
653
(should (eq ?p (char-after)))))
655
(ert-deftest py-complete-empty-string-result-test ()
656
(let ((py-shell-name "python3")
657
(py-switch-buffers-on-execute-p t))
658
(py-kill-buffer-unconditional "*Python3*")
660
(goto-char (point-max))
662
(py-indent-or-complete)
663
(should (looking-back "foo"))))
665
(ert-deftest py-ert-close-block-test ()
666
(py-test-with-temp-buffer-point-min
667
"# -*- coding: utf-8 -*-
673
if __name__==\"__main__\":
676
(search-forward "exit()")
677
(should (eq 4 (py-close-block)))))
679
(ert-deftest py-ert-close-def-or-class-test ()
680
(py-test-with-temp-buffer-point-min
681
"# -*- coding: utf-8 -*-
687
if __name__==\"__main__\":
690
(search-forward "exit()")
691
(should (eq 0 (py-close-def-or-class)))))
693
(ert-deftest py-ert-close-def-test ()
694
(py-test-with-temp-buffer-point-min
695
"# -*- coding: utf-8 -*-
701
if __name__==\"__main__\":
704
(search-forward "exit()")
705
(should (eq 0 (py-close-def)))))
707
(ert-deftest py-ert-close-class-test ()
708
(py-test-with-temp-buffer-point-min
709
"# -*- coding: utf-8 -*-
715
if __name__==\"__main__\":
718
(search-forward "exit()")
719
(should (eq 0 (py-close-class)))))
721
(ert-deftest py-ert-dedent-forward-test ()
722
(py-test-with-temp-buffer
723
"with file(\"roulette-\" + zeit + \".csv\", 'w') as datei:
724
for i in range(anzahl):
726
datei.write(str(spiel[i]) + \"\\n\")"
727
(skip-chars-backward " \t\r\n\f")
728
(py-dedent-forward-line)
729
(should (empty-line-p))
731
(should (eq 4 (current-indentation)))))
734
(ert-deftest py-face-lp-1454858-python2-1-test ()
735
(let ((py-python-edit-version ""))
736
(py-test-with-temp-buffer
737
"#! /usr/bin/env python2
740
(font-lock-fontify-buffer)
742
(should (eq (face-at-point) 'py-builtins-face)))))
744
;; Setting of py-python-edit-version should precede
745
(ert-deftest py-face-lp-1454858-python2-2-test ()
746
(let ((py-python-edit-version "python2"))
747
(py-test-with-temp-buffer
748
"#! /usr/bin/env python3
751
(font-lock-fontify-buffer)
753
(should (eq (face-at-point) 'py-builtins-face)))))
755
(ert-deftest py-face-lp-1454858-python2-3-test ()
756
(let ((py-python-edit-version ""))
758
(insert "#! /usr/bin/env python2
760
(switch-to-buffer (current-buffer))
763
(font-lock-fontify-buffer)
765
(should (eq (face-at-point) 'font-lock-keyword-face)))))
767
(ert-deftest py-ert-in-comment-p-test ()
768
(py-test-with-temp-buffer
770
(should (py--in-comment-p))))
772
(ert-deftest py-ert-in-sq-string-p-test ()
773
(py-test-with-temp-buffer
775
(should (py-in-string-p))))
777
(ert-deftest py-ert-in-dq-string-p-test ()
778
(py-test-with-temp-buffer
780
(should (py-in-string-p))))
782
(ert-deftest py-ert-in-sq-tqs-string-p-test ()
783
(py-test-with-temp-buffer
785
(should (py-in-string-p))))
787
(ert-deftest py-ert-in-dq-tqs-string-p-test ()
788
(py-test-with-temp-buffer
790
(should (py-in-string-p))))
792
(ert-deftest py-ert-electric-delete-test ()
793
(py-test-with-temp-buffer-point-min
796
(should (eq (char-after) ?{))))
798
(ert-deftest py-ert-end-of-def-or-class-test-1 ()
799
(py-test-with-temp-buffer-point-min
800
"class MyTest(unittest.TestCase):
802
self.assertEqual(fun(3), 4)"
803
(skip-chars-forward "^(")
804
(py-end-of-def-or-class)
807
(ert-deftest py-ert-end-of-def-or-class-test-2 ()
808
(py-test-with-temp-buffer-point-min
809
"class MyTest(unittest.TestCase):
814
(search-forward "pass")
815
(py-end-of-def-or-class)
818
(ert-deftest py-ert-narrow-to-block-test ()
819
(py-test-with-temp-buffer
820
"with file(\"roulette-\" + zeit + \".csv\", 'w') as datei:
821
for i in range(anzahl):
825
(should (eq 50 (length (buffer-substring-no-properties (point-min)(point-max)))))))
827
(ert-deftest py-ert-narrow-to-block-or-clause-test ()
828
(py-test-with-temp-buffer
829
"if treffer in gruen:
834
elif treffer in schwarz:
835
# print \"%i, Schwarz\" % (treffer)
838
(py-narrow-to-block-or-clause)
839
(should (eq 87 (length (buffer-substring-no-properties (point-min)(point-max)))))))
841
(ert-deftest py-ert-narrow-to-clause-test ()
842
(py-test-with-temp-buffer
843
"if treffer in gruen:
848
elif treffer in schwarz:
849
# print \"%i, Schwarz\" % (treffer)
852
(py-narrow-to-clause)
853
(should (eq 87 (length (buffer-substring-no-properties (point-min)(point-max)))))))
855
(ert-deftest py-ert-narrow-to-class-test ()
856
(py-test-with-temp-buffer
857
py-def-and-class-test-string
858
(search-backward "treffer")
860
(should (eq 710 (length (buffer-substring-no-properties (point-min)(point-max)))))))
862
(ert-deftest py-ert-narrow-to-def-test ()
863
(py-test-with-temp-buffer
864
py-def-and-class-test-string
865
(search-backward "treffer")
867
(should (< 480 (length (buffer-substring-no-properties (point-min)(point-max)))))))
869
(ert-deftest py-ert-narrow-to-def-or-class-test ()
870
(py-test-with-temp-buffer
871
py-def-and-class-test-string
872
(search-backward "treffer")
873
(py-narrow-to-def-or-class)
874
(should (< 480 (length (buffer-substring-no-properties (point-min)(point-max)))))
875
(should (> 490 (length (buffer-substring-no-properties (point-min)(point-max)))))))
877
(ert-deftest py-ert-narrow-to-statement-test ()
878
(py-test-with-temp-buffer
879
py-def-and-class-test-string
880
(search-backward "treffer")
881
(py-narrow-to-statement)
882
(should (eq 32 (length (buffer-substring-no-properties (point-min)(point-max)))))))
884
(ert-deftest py-ert-section-backward-test ()
885
(py-test-with-temp-buffer
887
print('%(language)s has %(number)03d quote types.' %
888
{'language': \"Python\", \"number\": 2})
891
print(\"%(language)s has %(number)03d quote types.\" %
892
{'language': \"Python\", \"number\": 2})
895
(py-backward-section)
896
(should (eq (char-after) ?#))
897
(py-backward-section)
898
(should (eq (char-after) ?#))))
900
(ert-deftest py-ert-section-forward-test ()
901
(py-test-with-temp-buffer-point-min
903
print('%(language)s has %(number)03d quote types.' %
904
{'language': \"Python\", \"number\": 2})
907
print(\"%(language)s has %(number)03d quote types.\" %
908
{'language': \"Python\", \"number\": 2})
912
(should (eq (char-before) ?}))
914
(should (eq (char-before) ?}))))
916
(ert-deftest py-ert-sectionize-test ()
917
(py-test-with-temp-buffer-point-min
918
"print('%(language)s has %(number)03d quote types.' %
919
{'language': \"Python\", \"number\": 2})
922
(py-sectionize-region (point-min) (point-max))
923
(goto-char (point-min))
924
(should (eq (char-after) ?#))
926
(should (eq (char-before) ?}))))
928
(ert-deftest py-ert-jump-matching-indent-test ()
929
(py-test-with-temp-buffer
930
py-def-and-class-test-string
931
(search-backward "if ")
935
(should (eq (current-column) 8))))
937
(ert-deftest py-ert-fill-plain-string-test ()
938
(py-test-with-temp-buffer-point-min
939
"'''asdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdf asdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdfasdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdf
944
(should (not (empty-line-p)))))
946
(ert-deftest py-ert-nil-docstring-style-lp-1477422-test ()
947
(py-test-with-temp-buffer-point-min
949
'''asdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdf asdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdfasdf' asdf asdf asdf asdf asdfasdf asdfasdf a asdf asdf asdf asdfasdfa asdf asdf asdf asdf'''"
950
(let (py-docstring-style)
951
(search-forward "'''")
955
(should (not (empty-line-p))))))
957
(ert-deftest py-markup-region-as-section-test ()
958
(py-test-with-temp-buffer-point-min
959
py-def-and-class-test-string
960
(search-forward "fertig")
961
(py-sectionize-region (match-beginning 0) (line-end-position))
963
(should (eq 371 (region-beginning)))
964
(should (eq 408 (region-end)))))
967
(ert-deftest py-indent-in-docstring-gh6 ()
968
(py-test-with-temp-buffer-point-min
976
second note line\"\"\"
978
(search-forward "second")
979
(back-to-indentation)
980
(should (eq 8 (py-compute-indentation)))))
982
(provide 'py-ert-tests-2)
983
;;; py-ert-tests-2.el ends here