@@ -1175,7 +1175,7 @@ def test_escape(self):
11751175check(b"[\\\n]", b"[]")
11761176check(br'[\"]', b'["]')
11771177check(br"[\']", b"[']")
1178-check(br"[\\]", br"[\]")
1178+check(br"[\\]", b"[\\]")
11791179check(br"[\a]", b"[\x07]")
11801180check(br"[\b]", b"[\x08]")
11811181check(br"[\t]", b"[\x09]")
@@ -1184,20 +1184,25 @@ def test_escape(self):
11841184check(br"[\f]", b"[\x0c]")
11851185check(br"[\r]", b"[\x0d]")
11861186check(br"[\7]", b"[\x07]")
1187-check(br"[\8]", br"[\8]")
11881187check(br"[\78]", b"[\x078]")
11891188check(br"[\41]", b"[!]")
11901189check(br"[\418]", b"[!8]")
11911190check(br"[\101]", b"[A]")
11921191check(br"[\1010]", b"[A0]")
11931192check(br"[\501]", b"[A]")
11941193check(br"[\x41]", b"[A]")
1195-check(br"[\X41]", br"[\X41]")
11961194check(br"[\x410]", b"[A0]")
1197-forbinrange(256):
1198-ifbnotinb'\n"\'\\abtnvfr01234567x':
1199-b=bytes([b])
1200-check(b'\\'+b, b'\\'+b)
1195+foriinrange(97, 123):
1196+b=bytes([i])
1197+ifbnotinb'abfnrtvx':
1198+withself.assertWarns(DeprecationWarning):
1199+check(b"\\"+b, b"\\"+b)
1200+withself.assertWarns(DeprecationWarning):
1201+check(b"\\"+b.upper(), b"\\"+b.upper())
1202+withself.assertWarns(DeprecationWarning):
1203+check(br"\8", b"\\8")
1204+withself.assertWarns(DeprecationWarning):
1205+check(br"\9", b"\\9")
1201120612021207deftest_errors(self):
12031208decode=codecs.escape_decode
@@ -2448,7 +2453,6 @@ def test_escape_decode(self):
24482453check(br"[\f]", "[\x0c]")
24492454check(br"[\r]", "[\x0d]")
24502455check(br"[\7]", "[\x07]")
2451-check(br"[\8]", r"[\8]")
24522456check(br"[\78]", "[\x078]")
24532457check(br"[\41]", "[!]")
24542458check(br"[\418]", "[!8]")
@@ -2458,9 +2462,18 @@ def test_escape_decode(self):
24582462check(br"[\x410]", "[A0]")
24592463check(br"\u20ac", "\u20ac")
24602464check(br"\U0001d120", "\U0001d120")
2461-forbinrange(256):
2462-ifbnotinb'\n"\'\\abtnvfr01234567xuUN':
2463-check(b'\\'+bytes([b]), '\\'+chr(b))
2465+foriinrange(97, 123):
2466+b=bytes([i])
2467+ifbnotinb'abfnrtuvx':
2468+withself.assertWarns(DeprecationWarning):
2469+check(b"\\"+b, "\\"+chr(i))
2470+ifb.upper() notinb'UN':
2471+withself.assertWarns(DeprecationWarning):
2472+check(b"\\"+b.upper(), "\\"+chr(i-32))
2473+withself.assertWarns(DeprecationWarning):
2474+check(br"\8", "\\8")
2475+withself.assertWarns(DeprecationWarning):
2476+check(br"\9", "\\9")
2464247724652478deftest_decode_errors(self):
24662479decode=codecs.unicode_escape_decode