summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorkobarity <kobarity@gmail.com>2022-05-22 18:53:00 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-05-22 18:54:23 +0200
commit45694a25948146e860738cb4e01de7e7e9aa91b0 (patch)
tree39b33e2398583882f3791f7c9926eccc3da34105 /test/lisp/progmodes/python-tests.el
parent91bc24c46768aab4a851c87edaea05c7476ff779 (diff)
downloademacs-45694a25948146e860738cb4e01de7e7e9aa91b0.tar.gz
Don't font-lock invalid invalid class/function names
* lisp/progmodes/python.el (python-font-lock-keywords-level-1): Don't font-lock invalid invalid class/function names (bug#55573).
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index a3f778bbbe9..479d68a0623 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -214,6 +214,18 @@ aliqua."
(should (string= (buffer-string) "\"\""))
(should (null (nth 3 (syntax-ppss))))))
+(ert-deftest python-font-lock-keywords-level-1-1 ()
+ (python-tests-assert-faces
+ "def func():"
+ '((1 . font-lock-keyword-face) (4)
+ (5 . font-lock-function-name-face) (9))))
+
+(ert-deftest python-font-lock-keywords-level-1-2 ()
+ "Invalid function name should not be font-locked."
+ (python-tests-assert-faces
+ "def 1func():"
+ '((1 . font-lock-keyword-face) (4))))
+
(ert-deftest python-font-lock-assignment-statement-1 ()
(python-tests-assert-faces
"a, b, c = 1, 2, 3"