diff options
Diffstat (limited to 'Lib/test/test_codeop.py')
-rw-r--r-- | Lib/test/test_codeop.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py index 0c5e362f..45cb1a7 100644 --- a/Lib/test/test_codeop.py +++ b/Lib/test/test_codeop.py @@ -303,6 +303,11 @@ class CodeopTests(unittest.TestCase): self.assertNotEqual(compile_command("a = 1\n", "abc").co_filename, compile("a = 1\n", "def", 'single').co_filename) + 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) if __name__ == "__main__": unittest.main() |