summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_raise.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r--Lib/test/test_raise.py20
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()