diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-01-24 19:26:24 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-01-24 19:26:24 (GMT) |
commit | e96159335f6bb26615b57f880bf90440ed0123e4 (patch) | |
tree | 273325221fdef15629ebc63287c4772a3af40879 /Lib/test/test_raise.py | |
parent | f41d29a8ebc27aafc18b6850648f1faa918e0e5d (diff) | |
download | cpython-e96159335f6bb26615b57f880bf90440ed0123e4.zip cpython-e96159335f6bb26615b57f880bf90440ed0123e4.tar.gz cpython-e96159335f6bb26615b57f880bf90440ed0123e4.tar.bz2 |
Merged revisions 77727 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77727 | ezio.melotti | 2010-01-24 18:58:36 +0200 (Sun, 24 Jan 2010) | 1 line
use assert[Not]IsInstance where appropriate
........
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r-- | Lib/test/test_raise.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py index 033df3b..d120dc1 100644 --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -135,7 +135,7 @@ class TestCause(unittest.TestCase): try: raise IndexError from KeyError except IndexError as e: - self.assertTrue(isinstance(e.__cause__, KeyError)) + self.assertIsInstance(e.__cause__, KeyError) else: self.fail("No exception raised") @@ -166,7 +166,7 @@ class TestTraceback(unittest.TestCase): try: raise IndexError() except IndexError as e: - self.assertTrue(isinstance(e.__traceback__, types.TracebackType)) + self.assertIsInstance(e.__traceback__, types.TracebackType) else: self.fail("No exception raised") @@ -203,7 +203,7 @@ class TestContext(unittest.TestCase): raise OSError() except OSError as e: self.assertNotEqual(e.__context__, context) - self.assertTrue(isinstance(e.__context__, context)) + self.assertIsInstance(e.__context__, context) else: self.fail("No exception raised") @@ -216,7 +216,7 @@ class TestContext(unittest.TestCase): raise OSError except OSError as e: self.assertNotEqual(e.__context__, context) - self.assertTrue(isinstance(e.__context__, context)) + self.assertIsInstance(e.__context__, context) else: self.fail("No exception raised") @@ -227,7 +227,7 @@ class TestContext(unittest.TestCase): except: raise OSError except OSError as e: - self.assertTrue(isinstance(e.__context__, ZeroDivisionError)) + self.assertIsInstance(e.__context__, ZeroDivisionError) else: self.fail("No exception raised") @@ -238,7 +238,7 @@ class TestContext(unittest.TestCase): except: xyzzy except NameError as e: - self.assertTrue(isinstance(e.__context__, ZeroDivisionError)) + self.assertIsInstance(e.__context__, ZeroDivisionError) else: self.fail("No exception raised") @@ -260,7 +260,7 @@ class TestContext(unittest.TestCase): finally: raise OSError except OSError as e: - self.assertTrue(isinstance(e.__context__, ZeroDivisionError)) + self.assertIsInstance(e.__context__, ZeroDivisionError) else: self.fail("No exception raised") @@ -274,7 +274,7 @@ class TestContext(unittest.TestCase): with ContextManager(): 1/0 except NameError as e: - self.assertTrue(isinstance(e.__context__, ZeroDivisionError)) + self.assertIsInstance(e.__context__, ZeroDivisionError) else: self.fail("No exception raised") @@ -320,7 +320,7 @@ class TestContext(unittest.TestCase): del g raise KeyError except Exception as e: - self.assertTrue(isinstance(e.__context__, ValueError)) + self.assertIsInstance(e.__context__, ValueError) f() @@ -344,7 +344,7 @@ class TestContext(unittest.TestCase): raise TypeError except Exception as e: self.assertNotEqual(e.__context__, None) - self.assertTrue(isinstance(e.__context__, AttributeError)) + self.assertIsInstance(e.__context__, AttributeError) with support.captured_output("stderr"): f() |