1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix Python block end predicates (bug#77941)

* lisp/progmodes/python.el (python-info-statement-ends-block-p)
(python-info-end-of-block-p): Add consideration of comments.
* test/lisp/progmodes/python-tests.el
(python-info-statement-ends-block-p-3)
(python-info-end-of-block-p-3): New tests.
This commit is contained in:
kobarity 2025-04-20 21:14:46 +09:00 committed by Eli Zaretskii
parent 7bb648eb80
commit 55cf15e163
2 changed files with 25 additions and 2 deletions

View file

@ -5821,6 +5821,15 @@ if width == 0 and height == 0 and \\
(python-tests-look-at "raise ValueError(")
(should (python-info-statement-ends-block-p))))
(ert-deftest python-info-statement-ends-block-p-3 ()
(python-tests-with-temp-buffer
"
def function():
print() # Comment
"
(python-tests-look-at "print()")
(should (python-info-statement-ends-block-p))))
(ert-deftest python-info-beginning-of-statement-p-1 ()
(python-tests-with-temp-buffer
"
@ -5983,6 +5992,15 @@ if width == 0 and height == 0 and \\
(python-util-forward-comment -1)
(should (python-info-end-of-block-p))))
(ert-deftest python-info-end-of-block-p-3 ()
(python-tests-with-temp-buffer
"
def function():
print() # Comment
"
(python-tests-look-at " # Comment")
(should (python-info-end-of-block-p))))
(ert-deftest python-info-dedenter-opening-block-position-1 ()
(python-tests-with-temp-buffer
"