diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2014-02-19 16:43:13 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2014-02-19 16:43:13 (GMT) |
commit | c77d4ba85b4d2f08b4de094bc9d9104113772374 (patch) | |
tree | 47abb8e7b88321afddc751672663490d5de77720 | |
parent | 3e0cb09e33f37543d096dae1fc38e6cc314f887e (diff) | |
download | cpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.zip cpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.tar.gz cpython-c77d4ba85b4d2f08b4de094bc9d9104113772374.tar.bz2 |
Issue #20510: Confirm that the code attribute of the SystemExit
exception raised by sys.exit is None when no code is given.
As suggested by Serhiy Storchaka.
-rw-r--r-- | Lib/test/test_sys.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 7c7e0af..745e4ad 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -119,6 +119,10 @@ class SysModuleTest(unittest.TestCase): self.assertRaises(TypeError, sys.exit, 42, 42) # call without argument + with self.assertRaises(SystemExit) as cm: + sys.exit() + self.assertIsNone(cm.exception.code) + rc, out, err = assert_python_ok('-c', 'import sys; sys.exit()') self.assertEqual(rc, 0) self.assertEqual(out, b'') |