Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(218)

Delta Between Two Patch Sets: Lib/test/test_exceptions.py

Issue 6210: Exception Chaining missing method for suppressing context
Left Patch Set: Created 1 year, 3 months ago
Right Patch Set: Created 1 year, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Include/pyerrors.h ('k') | Lib/test/test_raise.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Python test set -- part 5, built-in exceptions 1 # Python test set -- part 5, built-in exceptions
2 2
3 import os 3 import os
4 import sys 4 import sys
5 import unittest 5 import unittest
6 import pickle 6 import pickle
7 import weakref 7 import weakref
8 import errno 8 import errno
9 9
10 from test.support import (TESTFN, unlink, run_unittest, captured_output, 10 from test.support import (TESTFN, unlink, run_unittest, captured_output,
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 self.assertIsNone(e.__context__) 394 self.assertIsNone(e.__context__)
395 self.assertIs(e.__cause__, Ellipsis) 395 self.assertIs(e.__cause__, Ellipsis)
396 396
397 class MyException(EnvironmentError): 397 class MyException(EnvironmentError):
398 pass 398 pass
399 399
400 e = MyException() 400 e = MyException()
401 self.assertIsNone(e.__context__) 401 self.assertIsNone(e.__context__)
402 self.assertIs(e.__cause__, Ellipsis) 402 self.assertIs(e.__cause__, Ellipsis)
403 403
404 def testChainingDescriptors(self):
404 try: 405 try:
405 raise Exception() 406 raise Exception()
406 except Exception as exc: 407 except Exception as exc:
407 e = exc 408 e = exc
408 409
409 self.assertIsNone(e.__context__) 410 self.assertIsNone(e.__context__)
410 self.assertIs(e.__cause__, Ellipsis) 411 self.assertIs(e.__cause__, Ellipsis)
411 412
412 e.__context__ = NameError() 413 e.__context__ = NameError()
413 e.__cause__ = None 414 e.__cause__ = None
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 with self.assertRaises(OSError) as cm: 900 with self.assertRaises(OSError) as cm:
900 os.listdir(__file__) 901 os.listdir(__file__)
901 self.assertEqual(cm.exception.errno, errno.ENOTDIR, cm.exception) 902 self.assertEqual(cm.exception.errno, errno.ENOTDIR, cm.exception)
902 903
903 904
904 def test_main(): 905 def test_main():
905 run_unittest(ExceptionTests) 906 run_unittest(ExceptionTests)
906 907
907 if __name__ == '__main__': 908 if __name__ == '__main__':
908 unittest.main() 909 unittest.main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7