diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-19 14:42:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 14:42:06 (GMT) |
commit | 6543912c90ffa579dc4c01e811f9609cf92197d3 (patch) | |
tree | 44f433f463ad6624814d0f3c556501eeefb862b8 /Lib/test/test_string_literals.py | |
parent | 209144831b0a19715bda3bd72b14a3e6192d9cc1 (diff) | |
download | cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.zip cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.tar.gz cpython-6543912c90ffa579dc4c01e811f9609cf92197d3.tar.bz2 |
bpo-32912: Replace a DeprecationWarning with a SyntaxWarning (GH-9652)
for invalid escape sequences in string and bytes literals.
Diffstat (limited to 'Lib/test/test_string_literals.py')
-rw-r--r-- | Lib/test/test_string_literals.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py index aba4fc4..55bcde4 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -109,18 +109,18 @@ class TestLiterals(unittest.TestCase): for b in range(1, 128): if b in b"""\n\r"'01234567NU\\abfnrtuvx""": continue - with self.assertWarns(DeprecationWarning): + with self.assertWarns(SyntaxWarning): self.assertEqual(eval(r"'\%c'" % b), '\\' + chr(b)) with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', category=DeprecationWarning) + warnings.simplefilter('always', category=SyntaxWarning) eval("'''\n\\z'''") self.assertEqual(len(w), 1) self.assertEqual(w[0].filename, '<string>') self.assertEqual(w[0].lineno, 2) with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('error', category=DeprecationWarning) + warnings.simplefilter('error', category=SyntaxWarning) with self.assertRaises(SyntaxError) as cm: eval("'''\n\\z'''") exc = cm.exception @@ -158,18 +158,18 @@ class TestLiterals(unittest.TestCase): for b in range(1, 128): if b in b"""\n\r"'01234567\\abfnrtvx""": continue - with self.assertWarns(DeprecationWarning): + with self.assertWarns(SyntaxWarning): self.assertEqual(eval(r"b'\%c'" % b), b'\\' + bytes([b])) with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', category=DeprecationWarning) + warnings.simplefilter('always', category=SyntaxWarning) eval("b'''\n\\z'''") self.assertEqual(len(w), 1) self.assertEqual(w[0].filename, '<string>') self.assertEqual(w[0].lineno, 2) with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('error', category=DeprecationWarning) + warnings.simplefilter('error', category=SyntaxWarning) with self.assertRaises(SyntaxError) as cm: eval("b'''\n\\z'''") exc = cm.exception |