summaryrefslogtreecommitdiff
path: root/Lib/unittest/test/test_case.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-17 00:14:35 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-17 00:14:35 +0200
commitbc39869095d1d24084965d2c41056750ec579763 (patch)
tree71e8e32fa840d548eb5561ec13b34d4972ab3424 /Lib/unittest/test/test_case.py
parent8f203dda0c6cc57a8b9123d985fca978891a8095 (diff)
parent5665bc5980cd20252fe1d27807759cecee8594d0 (diff)
downloadcpython-git-bc39869095d1d24084965d2c41056750ec579763.tar.gz
Issue #19594: Use specific asserts in unittest tests.
Diffstat (limited to 'Lib/unittest/test/test_case.py')
-rw-r--r--Lib/unittest/test/test_case.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py
index 9aa9fd1312..4b93179335 100644
--- a/Lib/unittest/test/test_case.py
+++ b/Lib/unittest/test/test_case.py
@@ -407,7 +407,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
def test(self):
pass
- self.assertTrue(Foo('test').failureException is AssertionError)
+ self.assertIs(Foo('test').failureException, AssertionError)
# "This class attribute gives the exception raised by the test() method.
# If a test framework needs to use a specialized exception, possibly to
@@ -425,7 +425,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
failureException = RuntimeError
- self.assertTrue(Foo('test').failureException is RuntimeError)
+ self.assertIs(Foo('test').failureException, RuntimeError)
Foo('test').run(result)
@@ -448,7 +448,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
failureException = RuntimeError
- self.assertTrue(Foo('test').failureException is RuntimeError)
+ self.assertIs(Foo('test').failureException, RuntimeError)
Foo('test').run(result)
@@ -760,7 +760,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg = e.args[0]
else:
self.fail('assertSequenceEqual did not fail.')
- self.assertTrue(len(msg) < len(diff))
+ self.assertLess(len(msg), len(diff))
self.assertIn(omitted, msg)
self.maxDiff = len(diff) * 2
@@ -770,7 +770,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg = e.args[0]
else:
self.fail('assertSequenceEqual did not fail.')
- self.assertTrue(len(msg) > len(diff))
+ self.assertGreater(len(msg), len(diff))
self.assertNotIn(omitted, msg)
self.maxDiff = None
@@ -780,7 +780,7 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
msg = e.args[0]
else:
self.fail('assertSequenceEqual did not fail.')
- self.assertTrue(len(msg) > len(diff))
+ self.assertGreater(len(msg), len(diff))
self.assertNotIn(omitted, msg)
def testTruncateMessage(self):