From de684bea14173c1b2d46f8197cea2491d096df0a Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 19 Oct 2026 14:37:04 +0530 Subject: [PATCH 1/4] Test invalid raises match patterns Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- testing/python/raises_group.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testing/python/raises_group.py b/testing/python/raises_group.py index 950e71753c2..a5d8f4022b9 100644 --- a/testing/python/raises_group.py +++ b/testing/python/raises_group.py @@ -59,7 +59,6 @@ def test_raises_group() -> None: RaisesGroup(ValueError), ): raise ExceptionGroup("foo", (SyntaxError(),)) - # multiple exceptions with RaisesGroup(ValueError, SyntaxError): raise ExceptionGroup("foo", (ValueError(), SyntaxError())) @@ -1368,3 +1367,11 @@ def test_expected_matching_only_on_matching() -> None: RaisesGroup(TypeError, ValueError, TypeError), ): raise ExceptionGroup("", [TypeError()]) + + +def test_invalid_match_pattern() -> None: + with pytest.raises(Failed, match="Invalid regex pattern provided to 'match'"): + RaisesExc(ValueError, match="[") + + with pytest.raises(Failed, match="Invalid regex pattern provided to 'match'"): + RaisesGroup(ValueError, match="[") From ddcec341e676a17b4751d97d2e5deca1167c3f8c Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 19 Oct 2026 14:37:04 +0530 Subject: [PATCH 2/4] Restore RaisesGroup test separation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- testing/python/raises_group.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/python/raises_group.py b/testing/python/raises_group.py index a5d8f4022b9..98f6d52a655 100644 --- a/testing/python/raises_group.py +++ b/testing/python/raises_group.py @@ -59,6 +59,7 @@ def test_raises_group() -> None: RaisesGroup(ValueError), ): raise ExceptionGroup("foo", (SyntaxError(),)) + # multiple exceptions with RaisesGroup(ValueError, SyntaxError): raise ExceptionGroup("foo", (ValueError(), SyntaxError())) From fb8cca37968ad6ef300e564a80c41dac5bd4f10e Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 19 Oct 2026 15:17:22 +0530 Subject: [PATCH 3/4] Add contributor to AUTHORS Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index bd1e27cb37d..42942c8c84b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -211,6 +211,7 @@ Harald Armin Massa Harshna Henk-Jaap Wagenaar Henry Schreiner +Himanshu Holger Kohr Hugo van Kemenade Hui Wang (coldnight) From d634ea53bcb727664a743cc39508b933b9052799 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Mon, 19 Oct 2026 15:22:39 +0530 Subject: [PATCH 4/4] Add changelog for PR 15219 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- changelog/15219.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/15219.misc.rst diff --git a/changelog/15219.misc.rst b/changelog/15219.misc.rst new file mode 100644 index 00000000000..89a10ab57e0 --- /dev/null +++ b/changelog/15219.misc.rst @@ -0,0 +1 @@ +Added regression tests for invalid regular expression patterns in RaisesExc and RaisesGroup.