From 5cd0fac89fd4d8a45d3328124f0a581252eae688 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 18 Mar 2026 14:35:26 +0100 Subject: [PATCH] Update test_validators.py for Python 3.15a7 matches_re() error message changed in Python 3.15 alpha 7 with the introduction of re.prefixmatch(). --- tests/test_validators.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_validators.py b/tests/test_validators.py index 5ad2308eb..8caa64272 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -5,6 +5,7 @@ """ import re +import sys import pytest @@ -243,10 +244,13 @@ def test_catches_invalid_func(self): with pytest.raises(ValueError) as ei: matches_re("a", 0, lambda: None) - assert ( - "'func' must be one of None, fullmatch, match, search." - == ei.value.args[0] - ) + if sys.version_info >= (3, 15): + errmsg = ( + "'func' must be one of None, fullmatch, prefixmatch, search." + ) + else: + errmsg = "'func' must be one of None, fullmatch, match, search." + assert errmsg == ei.value.args[0] @pytest.mark.parametrize( "func", [None, getattr(re, "fullmatch", None), re.match, re.search]