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 1e559eb..15d80a3 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -590,6 +590,16 @@ class BuiltinTest(unittest.TestCase): if have_unicode: self.assertRaises(UnicodeError, hasattr, sys, unichr(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(1L)) |
