diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2020-08-13 17:18:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 17:18:49 (GMT) |
commit | c818b15fa59039de67022c29085d439fa5d3ef95 (patch) | |
tree | 7d5f50d4566164d94ac42da59ab141bed9d03adb /Lib/test | |
parent | 46d10b1237c67ff8347f533eda6a5468d098f7eb (diff) | |
download | cpython-c818b15fa59039de67022c29085d439fa5d3ef95.zip cpython-c818b15fa59039de67022c29085d439fa5d3ef95.tar.gz cpython-c818b15fa59039de67022c29085d439fa5d3ef95.tar.bz2 |
bpo-41520: Fix second codeop regression (GH-21848)
* bpo-41520: Fix second codeop repression
Fix the repression introduced by the initial regression fix.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_codeop.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py index 7984e5f..45d0a7d 100644 --- a/Lib/test/test_codeop.py +++ b/Lib/test/test_codeop.py @@ -307,14 +307,17 @@ class CodeopTests(unittest.TestCase): def test_warning(self): # Test that the warning is only returned once. - with warnings_helper.check_warnings((".*literal", SyntaxWarning)) as w: - compile_command("0 is 0") - self.assertEqual(len(w.warnings), 1) + with warnings_helper.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__": |