Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acee486

Browse files
committed
Repair failing test_sre.py.
This was a funny one! The test very subtly relied on 1.5.2's behavior of treating "\x%" as "\x%", i.e. ignoring that was an \x escape that didn't make sense. But /F implemented PEP 223, which causes 2.0 to raise an exception on the bad escape. Fixed by merely making the 3 such strings of this kind into raw strings.
1 parent 6ebd299 commit acee486

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/test/test_sre.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def test(expression, result, exception=None):
5050
test(r"""sre.match("\%03o" % i, chr(i)) != None""", 1)
5151
test(r"""sre.match("\%03o0" % i, chr(i)+"0") != None""", 1)
5252
test(r"""sre.match("\%03o8" % i, chr(i)+"8") != None""", 1)
53-
test(r"""sre.match("\x%02x" % i, chr(i)) != None""", 1)
54-
test(r"""sre.match("\x%02x0" % i, chr(i)+"0") != None""", 1)
55-
test(r"""sre.match("\x%02xz" % i, chr(i)+"z") != None""", 1)
53+
test(r"""sre.match(r"\x%02x" % i, chr(i)) != None""", 1)
54+
test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") != None""", 1)
55+
test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") != None""", 1)
5656
test(r"""sre.match("\911", "")""", None, sre.error)
5757

5858
#

0 commit comments

Comments
 (0)