From 7e51d11d2dfde9377eaf39e8df76d87d4e420dd5 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sat, 17 Jun 2023 11:50:50 -0500 Subject: [PATCH 1/2] Utils: Make match and case be highlighted as Python keywords --- spyder/utils/syntaxhighlighters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/utils/syntaxhighlighters.py b/spyder/utils/syntaxhighlighters.py index b35361afbdf..d286e376d1e 100644 --- a/spyder/utils/syntaxhighlighters.py +++ b/spyder/utils/syntaxhighlighters.py @@ -505,7 +505,7 @@ def get_code_cell_name(text): class PythonSH(BaseSH): """Python Syntax Highlighter""" # Syntax highlighting rules: - add_kw = ['async', 'await'] + add_kw = ['async', 'await', 'match', 'case'] PROG = re.compile(make_python_patterns(additional_keywords=add_kw), re.S) IDPROG = re.compile(r"\s+(\w+)", re.S) ASPROG = re.compile(r"\b(as)\b") From a256a60e9b9f513f9d2061ec26ae0f43fc0a424c Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sat, 17 Jun 2023 17:39:06 -0500 Subject: [PATCH 2/2] Testing: Fix test that started to fail with the latest Numpy version --- spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py index ff88fb43631..811e3f7bfc9 100644 --- a/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py +++ b/spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py @@ -25,6 +25,7 @@ from IPython.core import release as ipy_release from IPython.core.application import get_ipython_dir from flaky import flaky +import numpy as np from packaging.version import parse import pytest from qtpy.QtCore import Qt @@ -83,7 +84,8 @@ def test_banners(ipyconsole, qtbot): "open interval ..."]), ("vectorize", ["pyfunc", "otype", "signature"], - ["Generalized function class.
", + ["Returns an object that acts like pyfunc, but takes arrays as
input." + "
", "Define a vectorized function which takes a nested sequence ..."]), ("absolute", ["x", "/", "out"], @@ -91,6 +93,8 @@ def test_banners(ipyconsole, qtbot): ) @pytest.mark.skipif(not os.name == 'nt', reason="Times out on macOS and fails on Linux") +@pytest.mark.skipif(parse(np.__version__) < parse('1.25.0'), + reason="Documentation for np.vectorize is different") def test_get_calltips(ipyconsole, qtbot, function, signature, documentation): """Test that calltips show the documentation.""" shell = ipyconsole.get_current_shellwidget()