summaryrefslogtreecommitdiff
path: root/Lib/test/test_raise.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r--Lib/test/test_raise.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index d120dc1afa..e02c1af131 100644
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -121,6 +121,15 @@ class TestRaise(unittest.TestCase):
else:
self.fail("No exception raised")
+ def test_new_returns_invalid_instance(self):
+ # See issue #11627.
+ class MyException(Exception):
+ def __new__(cls, *args):
+ return object()
+
+ with self.assertRaises(TypeError):
+ raise MyException
+
class TestCause(unittest.TestCase):
def test_invalid_cause(self):