summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codeop.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-08-13 18:38:55 (GMT)
committerGitHub <noreply@github.com>2020-08-13 18:38:55 (GMT)
commita3416c13b51af25675e175d4ffe07d8b925e7dbf (patch)
tree2910ac8c9b29bd99ad17b58fd9f8d9bd6a06214b /Lib/test/test_codeop.py
parentafff51fc09993dff1693aacb440221314b163409 (diff)
downloadcpython-a3416c13b51af25675e175d4ffe07d8b925e7dbf.zip
cpython-a3416c13b51af25675e175d4ffe07d8b925e7dbf.tar.gz
cpython-a3416c13b51af25675e175d4ffe07d8b925e7dbf.tar.bz2
[3.9] bpo-41520: Fix second codeop regression (GH-21848)
Fix the repression introduced by the initial regression fix. (cherry picked from commit c818b15fa59039de67022c29085d439fa5d3ef95) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit f24430f1542ea2768793b48704ae2d4e241892ae) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/test/test_codeop.py')
-rw-r--r--Lib/test/test_codeop.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
index 1eae26b..01ee00c 100644
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -297,14 +297,17 @@ class CodeopTests(unittest.TestCase):
def test_warning(self):
# Test that the warning is only returned once.
- with support.check_warnings((".*literal", SyntaxWarning)) as w:
- compile_command("0 is 0")
- self.assertEqual(len(w.warnings), 1)
+ with support.check_warnings(
+ (".*literal", SyntaxWarning),
+ (".*invalid", DeprecationWarning),
+ ) as w:
+ compile_command(r"'\e' is 0")
+ self.assertEqual(len(w.warnings), 2)
# bpo-41520: check SyntaxWarning treated as an SyntaxError
- with self.assertRaises(SyntaxError):
+ with warnings.catch_warnings(), self.assertRaises(SyntaxError):
warnings.simplefilter('error', SyntaxWarning)
- compile_command('1 is 1\n', symbol='exec')
+ compile_command('1 is 1', symbol='exec')
if __name__ == "__main__":