Removing the keyword only restriction for the places argument in unittest.TestCase.assert[Not]AlmostEqual

This commit is contained in:
Michael Foord 2010-11-02 14:46:41 +00:00
parent e509ff4d5c
commit b36f8329c0
3 changed files with 9 additions and 6 deletions

View file

@ -652,8 +652,8 @@ Test cases
:meth:`failIfEqual`. :meth:`failIfEqual`.
.. method:: assertAlmostEqual(first, second, *, places=7, msg=None) .. method:: assertAlmostEqual(first, second, places=7, msg=None)
failUnlessAlmostEqual(first, second, *, places=7, msg=None) failUnlessAlmostEqual(first, second, places=7, msg=None)
Test that *first* and *second* are approximately equal by computing the Test that *first* and *second* are approximately equal by computing the
difference, rounding to the given number of decimal *places* (default 7), difference, rounding to the given number of decimal *places* (default 7),
@ -668,8 +668,8 @@ Test cases
:meth:`failUnlessAlmostEqual`. :meth:`failUnlessAlmostEqual`.
.. method:: assertNotAlmostEqual(first, second, *, places=7, msg=None) .. method:: assertNotAlmostEqual(first, second, places=7, msg=None)
failIfAlmostEqual(first, second, *, places=7, msg=None) failIfAlmostEqual(first, second, places=7, msg=None)
Test that *first* and *second* are not approximately equal by computing Test that *first* and *second* are not approximately equal by computing
the difference, rounding to the given number of decimal *places* (default the difference, rounding to the given number of decimal *places* (default

View file

@ -634,7 +634,7 @@ class TestCase(object):
msg = self._formatMessage(msg, '%r == %r' % (first, second)) msg = self._formatMessage(msg, '%r == %r' % (first, second))
raise self.failureException(msg) raise self.failureException(msg)
def assertAlmostEqual(self, first, second, *, places=7, msg=None): def assertAlmostEqual(self, first, second, places=7, msg=None):
"""Fail if the two objects are unequal as determined by their """Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places difference rounded to the given number of decimal places
(default 7) and comparing to zero. (default 7) and comparing to zero.
@ -647,7 +647,7 @@ class TestCase(object):
msg = self._formatMessage(msg, standardMsg) msg = self._formatMessage(msg, standardMsg)
raise self.failureException(msg) raise self.failureException(msg)
def assertNotAlmostEqual(self, first, second, *, places=7, msg=None): def assertNotAlmostEqual(self, first, second, places=7, msg=None):
"""Fail if the two objects are equal as determined by their """Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places difference rounded to the given number of decimal places
(default 7) and comparing to zero. (default 7) and comparing to zero.

View file

@ -143,6 +143,9 @@ C-API
Library Library
------- -------
- The keyword only restriction for the places argument in
unittest.TestCase.assert[Not]AlmostEqual methods has been removed.
- Issue 6706: asyncore accept() method no longer raises EWOULDBLOCK/ECONNABORTED - Issue 6706: asyncore accept() method no longer raises EWOULDBLOCK/ECONNABORTED
on incomplete connection attempt but returns None instead. on incomplete connection attempt but returns None instead.