diff options
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 52b337c..a74cc84 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -499,6 +499,16 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(TypeError, hasattr) self.assertEqual(False, hasattr(sys, chr(sys.maxunicode))) + # Check that hasattr allows SystemExit and KeyboardInterrupts by + class A: + def __getattr__(self, what): + raise KeyboardInterrupt + self.assertRaises(KeyboardInterrupt, hasattr, A(), "b") + class B: + def __getattr__(self, what): + raise SystemExit + self.assertRaises(SystemExit, hasattr, B(), "b") + def test_hash(self): hash(None) self.assertEqual(hash(1), hash(1)) |