summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-05-15 05:09:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-05-15 05:09:31 (GMT)
commitd5a1c44455d969968f453f029727bfc45e4ce0a9 (patch)
tree98e91aa8130d600df0b1fdf329bbdc9d60d4b14c /Lib/test/test_exceptions.py
parentd91dc623791fd9973b914a57540d89cb986da7c9 (diff)
downloadcpython-d5a1c44455d969968f453f029727bfc45e4ce0a9.zip
cpython-d5a1c44455d969968f453f029727bfc45e4ce0a9.tar.gz
cpython-d5a1c44455d969968f453f029727bfc45e4ce0a9.tar.bz2
PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 39ff85f..97762f9 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -388,18 +388,18 @@ class ExceptionTests(unittest.TestCase):
def testChainingAttrs(self):
e = Exception()
self.assertIsNone(e.__context__)
- self.assertIs(e.__cause__, Ellipsis)
+ self.assertIsNone(e.__cause__)
e = TypeError()
self.assertIsNone(e.__context__)
- self.assertIs(e.__cause__, Ellipsis)
+ self.assertIsNone(e.__cause__)
class MyException(EnvironmentError):
pass
e = MyException()
self.assertIsNone(e.__context__)
- self.assertIs(e.__cause__, Ellipsis)
+ self.assertIsNone(e.__cause__)
def testChainingDescriptors(self):
try:
@@ -408,15 +408,16 @@ class ExceptionTests(unittest.TestCase):
e = exc
self.assertIsNone(e.__context__)
- self.assertIs(e.__cause__, Ellipsis)
+ self.assertIsNone(e.__cause__)
+ self.assertFalse(e.__suppress_context__)
e.__context__ = NameError()
e.__cause__ = None
self.assertIsInstance(e.__context__, NameError)
self.assertIsNone(e.__cause__)
-
- e.__cause__ = Ellipsis
- self.assertIs(e.__cause__, Ellipsis)
+ self.assertTrue(e.__suppress_context__)
+ e.__suppress_context__ = False
+ self.assertFalse(e.__suppress_context__)
def testKeywordArgs(self):
# test that builtin exception don't take keyword args,