diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-13 13:25:09 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-13 13:25:09 -0500 |
| commit | f35fd9cbfc82488a5f421622eac081c270bfcf12 (patch) | |
| tree | 4e6f3542e0e2103d3cb19f02eb12602082b52da9 /test/backunittest.py | |
| parent | dad2e11e30da32a7c6014fe0d5c6fb398e1830f4 (diff) | |
| download | python-coveragepy-f35fd9cbfc82488a5f421622eac081c270bfcf12.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.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/backunittest.py b/test/backunittest.py index 28978c7..51f5df3 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), |
