Mercurial > hg
comparison tests/test-help.t @ 50304:805d4a462abb stable
py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences
Mercurial became very noisy after https://github.com/python/cpython/commit/a60ddd31be7ff96a8189e7483bf1eb2071d2bddf ,
for example:
$ python3.12 mercurial/store.py
mercurial/store.py:406: SyntaxWarning: invalid escape sequence '\.'
EXCLUDED = re.compile(b'.*undo\.[^/]+\.(nd?|i)$')
This verbosity made some tests fail.
The problems were mostly insufficiently escaped regexps, relying on the Python
parser/scanner preserving invalid escape sequences.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 07 Mar 2023 16:45:54 +0100 |
parents | 2282d8ac0fa9 |
children | f0d2b18f0274 |
comparison
equal
deleted
inserted
replaced
50303:0d3690f8ce2a | 50304:805d4a462abb |
---|---|
1986 This tests that section lookup by translated string isn't broken by | 1986 This tests that section lookup by translated string isn't broken by |
1987 such str.lower(). | 1987 such str.lower(). |
1988 | 1988 |
1989 $ "$PYTHON" <<EOF | 1989 $ "$PYTHON" <<EOF |
1990 > def escape(s): | 1990 > def escape(s): |
1991 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932')) | 1991 > return b''.join(br'\\u%x' % ord(uc) for uc in s.decode('cp932')) |
1992 > # translation of "record" in ja_JP.cp932 | 1992 > # translation of "record" in ja_JP.cp932 |
1993 > upper = b"\x8bL\x98^" | 1993 > upper = b"\x8bL\x98^" |
1994 > # str.lower()-ed section name should be treated as different one | 1994 > # str.lower()-ed section name should be treated as different one |
1995 > lower = b"\x8bl\x98^" | 1995 > lower = b"\x8bl\x98^" |
1996 > with open('ambiguous.py', 'wb') as fp: | 1996 > with open('ambiguous.py', 'wb') as fp: |