Commit 710ffade authored by Andreas Röhler's avatar Andreas Röhler
Browse files

#109, Comment outdents when it shouldn't

Tests added
parent 906b0a10
Python Mode News
================
New in version 6.3.1
-----------------------
Minor bugfixes
New in version 6.3.0
-----------------------
......
......@@ -17743,11 +17743,6 @@ neither 1 nor 4 will switch off `py-smart-indentation' for this execution.
This permits to correct allowed but unwanted indents. Similar to
`py-toggle-smart-indentation' resp. `py-smart-indentation-off' followed by TAB.
 
This function is normally used by `indent-line-function' resp.
\\[indent-for-tab-command].
When bound to TAB, \\[quoted-insert] TAB inserts a TAB.
OUTMOST-ONLY stops circling possible indent.
 
When `py-tab-shifts-region-p' is t, not just the current line,
......
......@@ -965,6 +965,68 @@ else: #<- this else is not possible to indent 1 tab
(should (eq 8 (current-indentation)))
))
(ert-deftest py-comment-shouldnt-outdent-109-test-vkJNom ()
(py-test-with-temp-buffer
"def addProductToShopify(sample)
try:
a = sample
except NoResultFound as e:
return False
# comment 1
# comment 2
# comment 3
return True
"
(goto-char (point-max))
(search-backward "comment" nil t 2)
(py-indent-line)
(should (eq 4 (current-indentation)))
))
(ert-deftest py-comment-shouldnt-outdent-109-test-gZKk9W ()
(py-test-with-temp-buffer
"def addProductToShopify(sample)
try:
a = sample
except NoResultFound as e:
return False
# comment 1
# comment
# comment 3
return True
"
(goto-char (point-max))
(search-backward "comment" nil t 2)
(py-indent-line)
(should (eq 4 (current-indentation)))
(beginning-of-line)
(should (eq (char-after) 9))
))
(ert-deftest py-comment-shouldnt-outdent-109-test-P6QZmU ()
(py-test-with-temp-buffer
"def addProductToShopify(sample)
try:
a = sample
except NoResultFound as e:
return False
# comment 1
# comment
# comment 3
return True
"
(let ((py-indent-tabs-mode t))
(goto-char (point-max))
(search-backward "comment" nil t 2)
(py-indent-line)
(should (eq 4 (current-indentation)))
(beginning-of-line)
(should (eq (char-after) 9))
)))
(provide 'py-ert-indent-tests-1)
;;; py-ert-indent-tests-1.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment