From b36f8329c06bba56e25698452f4bfabdd9fb4126 Mon Sep 17 00:00:00 2001 From: Michael Foord Date: Tue, 2 Nov 2010 14:46:41 +0000 Subject: [PATCH] Removing the keyword only restriction for the places argument in unittest.TestCase.assert[Not]AlmostEqual --- Doc/library/unittest.rst | 8 ++++---- Lib/unittest.py | 4 ++-- Misc/NEWS | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index d88b8230b59..4c291196b7a 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -652,8 +652,8 @@ Test cases :meth:`failIfEqual`. - .. method:: assertAlmostEqual(first, second, *, places=7, msg=None) - failUnlessAlmostEqual(first, second, *, places=7, msg=None) + .. method:: assertAlmostEqual(first, second, places=7, msg=None) + failUnlessAlmostEqual(first, second, places=7, msg=None) Test that *first* and *second* are approximately equal by computing the difference, rounding to the given number of decimal *places* (default 7), @@ -668,8 +668,8 @@ Test cases :meth:`failUnlessAlmostEqual`. - .. method:: assertNotAlmostEqual(first, second, *, places=7, msg=None) - failIfAlmostEqual(first, second, *, places=7, msg=None) + .. method:: assertNotAlmostEqual(first, second, places=7, msg=None) + failIfAlmostEqual(first, second, places=7, msg=None) Test that *first* and *second* are not approximately equal by computing the difference, rounding to the given number of decimal *places* (default diff --git a/Lib/unittest.py b/Lib/unittest.py index c27fac1cbf9..ea9f5f64fb0 100644 --- a/Lib/unittest.py +++ b/Lib/unittest.py @@ -634,7 +634,7 @@ class TestCase(object): msg = self._formatMessage(msg, '%r == %r' % (first, second)) 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 difference rounded to the given number of decimal places (default 7) and comparing to zero. @@ -647,7 +647,7 @@ class TestCase(object): msg = self._formatMessage(msg, standardMsg) 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 difference rounded to the given number of decimal places (default 7) and comparing to zero. diff --git a/Misc/NEWS b/Misc/NEWS index d690318652f..30eb8257ed5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -143,6 +143,9 @@ C-API 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 on incomplete connection attempt but returns None instead.