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) 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. diff --git a/testing/python/raises_group.py b/testing/python/raises_group.py index 950e71753c2..98f6d52a655 100644 --- a/testing/python/raises_group.py +++ b/testing/python/raises_group.py @@ -1368,3 +1368,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="[")