summaryrefslogtreecommitdiff
path: root/test/backunittest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-12-13 13:25:09 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-12-13 13:25:09 -0500
commitdfddc64a9d695b5df019eadfb7ffc160abc38327 (patch)
treee05eae9c5e5a47bab9c534e92edd9388b33c6746 /test/backunittest.py
parent14341484c91c5241ec9b992bea22d285bbf78b40 (diff)
downloadpython-coveragepy-git-dfddc64a9d695b5df019eadfb7ffc160abc38327.tar.gz
I never liked the assert_ method anyway. Use assertTrue and assertFalse instead.
Diffstat (limited to 'test/backunittest.py')
-rw-r--r--test/backunittest.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/backunittest.py b/test/backunittest.py
index 28978c78..51f5df36 100644
--- a/test/backunittest.py
+++ b/test/backunittest.py
@@ -17,11 +17,17 @@ class TestCase(unittest.TestCase):
the builtin `unittest` doesn't have them.
"""
+ if _need('assertTrue'):
+ def assertTrue(self, exp, msg=None):
+ """Assert that `exp` is true."""
+ if not exp:
+ self.fail(msg)
+
if _need('assertFalse'):
- def assertFalse(self, exp):
+ def assertFalse(self, exp, msg=None):
"""Assert that `exp` is false."""
if exp:
- self.fail()
+ self.fail(msg)
if _need('assertRaisesRegexp'):
def assertRaisesRegexp(self, excClass, regexp, callobj, *args, **kw):
@@ -74,10 +80,10 @@ class TestCase(unittest.TestCase):
"""
# Adapted from Py3.1 unittest.
- self.assert_(isinstance(first, str), (
- 'First argument is not a string'))
- self.assert_(isinstance(second, str), (
- 'Second argument is not a string'))
+ self.assertTrue(isinstance(first, str),
+ 'First argument is not a string')
+ self.assertTrue(isinstance(second, str),
+ 'Second argument is not a string')
if first != second:
msg = ''.join(difflib.ndiff(first.splitlines(True),