aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/python-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/automated/python-tests.el')
-rw-r--r--test/automated/python-tests.el35
1 files changed, 24 insertions, 11 deletions
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 22c111fc04a..47264c3ad31 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -1014,7 +1014,7 @@ lines
1014def fn(a, b, c=True): 1014def fn(a, b, c=True):
1015 '''docstring 1015 '''docstring
1016 bunch 1016 bunch
1017 of 1017 of
1018 lines 1018 lines
1019 ''' 1019 '''
1020" 1020"
@@ -1022,16 +1022,17 @@ def fn(a, b, c=True):
1022 (should (eq (car (python-indent-context)) :after-block-start)) 1022 (should (eq (car (python-indent-context)) :after-block-start))
1023 (should (= (python-indent-calculate-indentation) 4)) 1023 (should (= (python-indent-calculate-indentation) 4))
1024 (python-tests-look-at "bunch") 1024 (python-tests-look-at "bunch")
1025 (should (eq (car (python-indent-context)) :inside-string)) 1025 (should (eq (car (python-indent-context)) :inside-docstring))
1026 (should (= (python-indent-calculate-indentation) 4)) 1026 (should (= (python-indent-calculate-indentation) 4))
1027 (python-tests-look-at "of") 1027 (python-tests-look-at "of")
1028 (should (eq (car (python-indent-context)) :inside-string)) 1028 (should (eq (car (python-indent-context)) :inside-docstring))
1029 (should (= (python-indent-calculate-indentation) 4)) 1029 ;; Any indentation deeper than the base-indent must remain unmodified.
1030 (should (= (python-indent-calculate-indentation) 8))
1030 (python-tests-look-at "lines") 1031 (python-tests-look-at "lines")
1031 (should (eq (car (python-indent-context)) :inside-string)) 1032 (should (eq (car (python-indent-context)) :inside-docstring))
1032 (should (= (python-indent-calculate-indentation) 4)) 1033 (should (= (python-indent-calculate-indentation) 4))
1033 (python-tests-look-at "'''") 1034 (python-tests-look-at "'''")
1034 (should (eq (car (python-indent-context)) :inside-string)) 1035 (should (eq (car (python-indent-context)) :inside-docstring))
1035 (should (= (python-indent-calculate-indentation) 4)))) 1036 (should (= (python-indent-calculate-indentation) 4))))
1036 1037
1037(ert-deftest python-indent-inside-string-3 () 1038(ert-deftest python-indent-inside-string-3 ()
@@ -1189,21 +1190,33 @@ def f():
1189 expected))))) 1190 expected)))))
1190 1191
1191(ert-deftest python-indent-region-5 () 1192(ert-deftest python-indent-region-5 ()
1192 "Test region indentation leaves strings untouched (start delimiter)." 1193 "Test region indentation for docstrings."
1193 (let ((contents " 1194 (let ((contents "
1194def f(): 1195def f():
1195''' 1196'''
1196this is 1197this is
1197a multiline 1198 a multiline
1198string 1199string
1199''' 1200'''
1201 x = \\
1202 '''
1203this is an arbitrarily
1204 indented multiline
1205 string
1206'''
1200") 1207")
1201 (expected " 1208 (expected "
1202def f(): 1209def f():
1203 ''' 1210 '''
1204this is 1211 this is
1205a multiline 1212 a multiline
1206string 1213 string
1214 '''
1215 x = \\
1216 '''
1217this is an arbitrarily
1218 indented multiline
1219 string
1207''' 1220'''
1208")) 1221"))
1209 (python-tests-with-temp-buffer 1222 (python-tests-with-temp-buffer