aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
authorJostein Kjønigsen2025-05-05 09:45:36 +0200
committerMichael Albinus2025-05-05 09:45:36 +0200
commit9261d353ccc0f94da8049faaade025f338d75354 (patch)
tree7bc125a331a6f5626d710f41dc9ada80e874ae80 /test/lisp/progmodes/python-tests.el
parent7cb7e96a5cca6778054cf74fd2c7548ca40f0691 (diff)
downloademacs-9261d353ccc0f94da8049faaade025f338d75354.tar.gz
emacs-9261d353ccc0f94da8049faaade025f338d75354.zip
Fix test-regressions in python-ts-mode
* lisp/progmodes/python.el (python--treesit-settings): Use more specific selectors for constants. * test/lisp/progmodes/python-tests.el (python-ts-mode-nested-types-face-1) (python-ts-mode-union-types-face-1) (python-ts-mode-union-types-face-2): None is now a constant.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 22a7c3a5e89..2c00f47d82c 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -7742,27 +7742,45 @@ always located at the beginning of buffer."
7742(ert-deftest python-ts-mode-nested-types-face-1 () 7742(ert-deftest python-ts-mode-nested-types-face-1 ()
7743 (python-ts-tests-with-temp-buffer 7743 (python-ts-tests-with-temp-buffer
7744 "def func(v:dict[ list[ tuple[str] ], int | None] | None):" 7744 "def func(v:dict[ list[ tuple[str] ], int | None] | None):"
7745 (dolist (test '("dict" "list" "tuple" "str" "int" "None" "None")) 7745 (dolist (test '("dict" "list" "tuple" "str" "int"))
7746 (search-forward test) 7746 (search-forward test)
7747 (goto-char (match-beginning 0)) 7747 (goto-char (match-beginning 0))
7748 (should (eq (face-at-point) 'font-lock-type-face))))) 7748 (should (eq (face-at-point) 'font-lock-type-face)))
7749
7750 (goto-char (point-min))
7751 (dolist (test '("None" "None"))
7752 (search-forward test)
7753 (goto-char (match-beginning 0))
7754 (should (eq (face-at-point) 'font-lock-constant-face)))))
7749 7755
7750(ert-deftest python-ts-mode-union-types-face-1 () 7756(ert-deftest python-ts-mode-union-types-face-1 ()
7751 (python-ts-tests-with-temp-buffer 7757 (python-ts-tests-with-temp-buffer
7752 "def f(val: tuple[tuple, list[Lvl1 | Lvl2[Lvl3[Lvl4[Lvl5 | None]], Lvl2]]]):" 7758 "def f(val: tuple[tuple, list[Lvl1 | Lvl2[Lvl3[Lvl4[Lvl5 | None]], Lvl2]]]):"
7753 (dolist (test '("tuple" "tuple" "list" "Lvl1" "Lvl2" "Lvl3" "Lvl4" "Lvl5" "None" "Lvl2")) 7759 (dolist (test '("tuple" "tuple" "list" "Lvl1" "Lvl2" "Lvl3" "Lvl4" "Lvl5" "Lvl2"))
7754 (search-forward test) 7760 (search-forward test)
7755 (goto-char (match-beginning 0)) 7761 (goto-char (match-beginning 0))
7756 (should (eq (face-at-point) 'font-lock-type-face))))) 7762 (should (eq (face-at-point) 'font-lock-type-face)))
7763
7764 (goto-char (point-min))
7765 (dolist (test '("None"))
7766 (search-forward test)
7767 (goto-char (match-beginning 0))
7768 (should (eq (face-at-point) 'font-lock-constant-face)))))
7757 7769
7758(ert-deftest python-ts-mode-union-types-face-2 () 7770(ert-deftest python-ts-mode-union-types-face-2 ()
7759 (python-ts-tests-with-temp-buffer 7771 (python-ts-tests-with-temp-buffer
7760 "def f(val: Type0 | Type1[Type2, pack0.Type3] | pack1.pack2.Type4 | None):" 7772 "def f(val: Type0 | Type1[Type2, pack0.Type3] | pack1.pack2.Type4 | None):"
7761 (dolist (test '("Type0" "Type1" "Type2" "Type3" "Type4" "None")) 7773 (dolist (test '("Type0" "Type1" "Type2" "Type3" "Type4"))
7762 (search-forward test) 7774 (search-forward test)
7763 (goto-char (match-beginning 0)) 7775 (goto-char (match-beginning 0))
7764 (should (eq (face-at-point) 'font-lock-type-face))) 7776 (should (eq (face-at-point) 'font-lock-type-face)))
7765 7777
7778 (goto-char (point-min))
7779 (dolist (test '("None"))
7780 (search-forward test)
7781 (goto-char (match-beginning 0))
7782 (should (eq (face-at-point) 'font-lock-constant-face)))
7783
7766 (goto-char (point-min)) 7784 (goto-char (point-min))
7767 (dolist (test '("pack0" "pack1" "pack2")) 7785 (dolist (test '("pack0" "pack1" "pack2"))
7768 (search-forward test) 7786 (search-forward test)