diff options
author | Tim Peters <tim.peters@gmail.com> | 2005-12-25 23:18:31 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2005-12-25 23:18:31 (GMT) |
commit | 536cf99536bce562cfcb44a856fac1c84b9de4c3 (patch) | |
tree | 80cf0f425cfc703b228aad716ed66cd4a5080c03 /Lib/test/test_exception_variations.py | |
parent | 83a8c393b06d24b3c6b252b7614c34110c369c43 (diff) | |
download | cpython-536cf99536bce562cfcb44a856fac1c84b9de4c3.zip cpython-536cf99536bce562cfcb44a856fac1c84b9de4c3.tar.gz cpython-536cf99536bce562cfcb44a856fac1c84b9de4c3.tar.bz2 |
Whitespace normalization.
Diffstat (limited to 'Lib/test/test_exception_variations.py')
-rw-r--r-- | Lib/test/test_exception_variations.py | 360 |
1 files changed, 180 insertions, 180 deletions
diff --git a/Lib/test/test_exception_variations.py b/Lib/test/test_exception_variations.py index 297a6c9..754d452 100644 --- a/Lib/test/test_exception_variations.py +++ b/Lib/test/test_exception_variations.py @@ -1,180 +1,180 @@ - -from test.test_support import run_unittest -import unittest - -class ExceptionTestCase(unittest.TestCase): - def test_try_except_else_finally(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - raise Exception, 'nyaa!' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - self.assertFalse(hit_else) - - def test_try_except_else_finally_no_exception(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - self.assertTrue(hit_else) - - def test_try_except_finally(self): - hit_except = False - hit_finally = False - - try: - raise Exception, 'yarr!' - except: - hit_except = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - - def test_try_except_finally_no_exception(self): - hit_except = False - hit_finally = False - - try: - pass - except: - hit_except = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - - def test_try_except(self): - hit_except = False - - try: - raise Exception, 'ahoy!' - except: - hit_except = True - - self.assertTrue(hit_except) - - def test_try_except_no_exception(self): - hit_except = False - - try: - pass - except: - hit_except = True - - self.assertFalse(hit_except) - - def test_try_except_else(self): - hit_except = False - hit_else = False - - try: - raise Exception, 'foo!' - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_else) - self.assertTrue(hit_except) - - def test_try_except_else_no_exception(self): - hit_except = False - hit_else = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_except) - self.assertTrue(hit_else) - - def test_try_finally_no_exception(self): - hit_finally = False - - try: - pass - finally: - hit_finally = True - - self.assertTrue(hit_finally) - - def test_nested(self): - hit_finally = False - hit_inner_except = False - hit_inner_finally = False - - try: - try: - raise Exception, 'inner exception' - except: - hit_inner_except = True - finally: - hit_inner_finally = True - finally: - hit_finally = True - - self.assertTrue(hit_inner_except) - self.assertTrue(hit_inner_finally) - self.assertTrue(hit_finally) - - def test_nested_else(self): - hit_else = False - hit_finally = False - hit_except = False - hit_inner_except = False - hit_inner_else = False - - try: - try: - pass - except: - hit_inner_except = True - else: - hit_inner_else = True - - raise Exception, 'outer exception' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_inner_except) - self.assertTrue(hit_inner_else) - self.assertFalse(hit_else) - self.assertTrue(hit_finally) - self.assertTrue(hit_except) - -def test_main(): - run_unittest(ExceptionTestCase) - -if __name__ == '__main__': - test_main() +
+from test.test_support import run_unittest
+import unittest
+
+class ExceptionTestCase(unittest.TestCase):
+ def test_try_except_else_finally(self):
+ hit_except = False
+ hit_else = False
+ hit_finally = False
+
+ try:
+ raise Exception, 'nyaa!'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_except)
+ self.assertTrue(hit_finally)
+ self.assertFalse(hit_else)
+
+ def test_try_except_else_finally_no_exception(self):
+ hit_except = False
+ hit_else = False
+ hit_finally = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_finally)
+ self.assertTrue(hit_else)
+
+ def test_try_except_finally(self):
+ hit_except = False
+ hit_finally = False
+
+ try:
+ raise Exception, 'yarr!'
+ except:
+ hit_except = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_except)
+ self.assertTrue(hit_finally)
+
+ def test_try_except_finally_no_exception(self):
+ hit_except = False
+ hit_finally = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_finally)
+
+ def test_try_except(self):
+ hit_except = False
+
+ try:
+ raise Exception, 'ahoy!'
+ except:
+ hit_except = True
+
+ self.assertTrue(hit_except)
+
+ def test_try_except_no_exception(self):
+ hit_except = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+
+ self.assertFalse(hit_except)
+
+ def test_try_except_else(self):
+ hit_except = False
+ hit_else = False
+
+ try:
+ raise Exception, 'foo!'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+
+ self.assertFalse(hit_else)
+ self.assertTrue(hit_except)
+
+ def test_try_except_else_no_exception(self):
+ hit_except = False
+ hit_else = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_else)
+
+ def test_try_finally_no_exception(self):
+ hit_finally = False
+
+ try:
+ pass
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_finally)
+
+ def test_nested(self):
+ hit_finally = False
+ hit_inner_except = False
+ hit_inner_finally = False
+
+ try:
+ try:
+ raise Exception, 'inner exception'
+ except:
+ hit_inner_except = True
+ finally:
+ hit_inner_finally = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_inner_except)
+ self.assertTrue(hit_inner_finally)
+ self.assertTrue(hit_finally)
+
+ def test_nested_else(self):
+ hit_else = False
+ hit_finally = False
+ hit_except = False
+ hit_inner_except = False
+ hit_inner_else = False
+
+ try:
+ try:
+ pass
+ except:
+ hit_inner_except = True
+ else:
+ hit_inner_else = True
+
+ raise Exception, 'outer exception'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_inner_except)
+ self.assertTrue(hit_inner_else)
+ self.assertFalse(hit_else)
+ self.assertTrue(hit_finally)
+ self.assertTrue(hit_except)
+
+def test_main():
+ run_unittest(ExceptionTestCase)
+
+if __name__ == '__main__':
+ test_main()
|