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

Side by Side Diff: Lib/test/test_exceptions.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 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:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_email/test_utils.py ('k') | Lib/test/test_extcall.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 from test.support import (TESTFN, unlink, run_unittest, captured_output, 9 from test.support import (TESTFN, unlink, run_unittest, captured_output,
10 gc_collect, cpython_only, no_tracing) 10 gc_collect, cpython_only, no_tracing)
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 raise TypeError("foo") 559 raise TypeError("foo")
560 except TypeError: 560 except TypeError:
561 g = yield_raise() 561 g = yield_raise()
562 self.assertEqual(next(g), KeyError) 562 self.assertEqual(next(g), KeyError)
563 self.assertEqual(sys.exc_info()[0], TypeError) 563 self.assertEqual(sys.exc_info()[0], TypeError)
564 self.assertEqual(next(g), KeyError) 564 self.assertEqual(next(g), KeyError)
565 self.assertEqual(sys.exc_info()[0], TypeError) 565 self.assertEqual(sys.exc_info()[0], TypeError)
566 self.assertEqual(next(g), TypeError) 566 self.assertEqual(next(g), TypeError)
567 del g 567 del g
568 self.assertEqual(sys.exc_info()[0], TypeError) 568 self.assertEqual(sys.exc_info()[0], TypeError)
569
570 def test_generator_leaking2(self):
571 # See issue 12475.
572 def g():
573 yield
574 try:
575 raise RuntimeError
576 except RuntimeError:
577 it = g()
578 next(it)
579 try:
580 next(it)
581 except StopIteration:
582 pass
583 self.assertEqual(sys.exc_info(), (None, None, None))
584
585 def test_generator_doesnt_retain_old_exc(self):
586 def g():
587 self.assertIsInstance(sys.exc_info()[1], RuntimeError)
588 yield
589 self.assertEqual(sys.exc_info(), (None, None, None))
590 it = g()
591 try:
592 raise RuntimeError
593 except RuntimeError:
594 next(it)
595 self.assertRaises(StopIteration, next, it)
596 569
597 def test_generator_finalizing_and_exc_info(self): 570 def test_generator_finalizing_and_exc_info(self):
598 # See #7173 571 # See #7173
599 def simple_gen(): 572 def simple_gen():
600 yield 1 573 yield 1
601 def run_gen(): 574 def run_gen():
602 gen = simple_gen() 575 gen = simple_gen()
603 try: 576 try:
604 raise RuntimeError 577 raise RuntimeError
605 except RuntimeError: 578 except RuntimeError:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 self.assertNotEqual(wr(), None) 761 self.assertNotEqual(wr(), None)
789 else: 762 else:
790 self.fail("RuntimeError not raised") 763 self.fail("RuntimeError not raised")
791 self.assertEqual(wr(), None) 764 self.assertEqual(wr(), None)
792 765
793 def test_main(): 766 def test_main():
794 run_unittest(ExceptionTests) 767 run_unittest(ExceptionTests)
795 768
796 if __name__ == '__main__': 769 if __name__ == '__main__':
797 unittest.main() 770 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_email/test_utils.py ('k') | Lib/test/test_extcall.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+