mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Use lowercase true/false in assertTrue/assertFalse messages.
This commit is contained in:
parent
b68a7bc70c
commit
3044fa77a5
2 changed files with 8 additions and 8 deletions
|
|
@ -477,15 +477,15 @@ class TestCase(object):
|
||||||
raise self.failureException(msg)
|
raise self.failureException(msg)
|
||||||
|
|
||||||
def assertFalse(self, expr, msg=None):
|
def assertFalse(self, expr, msg=None):
|
||||||
"Fail the test if the expression is true."
|
"""Check that the expression is false."""
|
||||||
if expr:
|
if expr:
|
||||||
msg = self._formatMessage(msg, "%s is not False" % safe_repr(expr))
|
msg = self._formatMessage(msg, "%s is not false" % safe_repr(expr))
|
||||||
raise self.failureException(msg)
|
raise self.failureException(msg)
|
||||||
|
|
||||||
def assertTrue(self, expr, msg=None):
|
def assertTrue(self, expr, msg=None):
|
||||||
"""Fail the test unless the expression is true."""
|
"""Check that the expression is true."""
|
||||||
if not expr:
|
if not expr:
|
||||||
msg = self._formatMessage(msg, "%s is not True" % safe_repr(expr))
|
msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr))
|
||||||
raise self.failureException(msg)
|
raise self.failureException(msg)
|
||||||
|
|
||||||
def _formatMessage(self, msg, standardMsg):
|
def _formatMessage(self, msg, standardMsg):
|
||||||
|
|
|
||||||
|
|
@ -166,13 +166,13 @@ class TestLongMessage(unittest.TestCase):
|
||||||
|
|
||||||
def testAssertTrue(self):
|
def testAssertTrue(self):
|
||||||
self.assertMessages('assertTrue', (False,),
|
self.assertMessages('assertTrue', (False,),
|
||||||
["^False is not True$", "^oops$", "^False is not True$",
|
["^False is not true$", "^oops$", "^False is not true$",
|
||||||
"^False is not True : oops$"])
|
"^False is not true : oops$"])
|
||||||
|
|
||||||
def testAssertFalse(self):
|
def testAssertFalse(self):
|
||||||
self.assertMessages('assertFalse', (True,),
|
self.assertMessages('assertFalse', (True,),
|
||||||
["^True is not False$", "^oops$", "^True is not False$",
|
["^True is not false$", "^oops$", "^True is not false$",
|
||||||
"^True is not False : oops$"])
|
"^True is not false : oops$"])
|
||||||
|
|
||||||
def testNotEqual(self):
|
def testNotEqual(self):
|
||||||
self.assertMessages('assertNotEqual', (1, 1),
|
self.assertMessages('assertNotEqual', (1, 1),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue