Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b36f832

Browse files
author
Michael Foord
committed
Removing the keyword only restriction for the places argument in unittest.TestCase.assert[Not]AlmostEqual
1 parent e509ff4 commit b36f832

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

Doc/library/unittest.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ Test cases
652652
:meth:`failIfEqual`.
653653

654654

655-
.. method:: assertAlmostEqual(first, second, *, places=7, msg=None)
656-
failUnlessAlmostEqual(first, second, *, places=7, msg=None)
655+
.. method:: assertAlmostEqual(first, second, places=7, msg=None)
656+
failUnlessAlmostEqual(first, second, places=7, msg=None)
657657

658658
Test that *first* and *second* are approximately equal by computing the
659659
difference, rounding to the given number of decimal *places* (default 7),
@@ -668,8 +668,8 @@ Test cases
668668
:meth:`failUnlessAlmostEqual`.
669669

670670

671-
.. method:: assertNotAlmostEqual(first, second, *, places=7, msg=None)
672-
failIfAlmostEqual(first, second, *, places=7, msg=None)
671+
.. method:: assertNotAlmostEqual(first, second, places=7, msg=None)
672+
failIfAlmostEqual(first, second, places=7, msg=None)
673673

674674
Test that *first* and *second* are not approximately equal by computing
675675
the difference, rounding to the given number of decimal *places* (default

Lib/unittest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def assertNotEqual(self, first, second, msg=None):
634634
msg = self._formatMessage(msg, '%r == %r' % (first, second))
635635
raise self.failureException(msg)
636636

637-
def assertAlmostEqual(self, first, second, *, places=7, msg=None):
637+
def assertAlmostEqual(self, first, second, places=7, msg=None):
638638
"""Fail if the two objects are unequal as determined by their
639639
difference rounded to the given number of decimal places
640640
(default 7) and comparing to zero.
@@ -647,7 +647,7 @@ def assertAlmostEqual(self, first, second, *, places=7, msg=None):
647647
msg = self._formatMessage(msg, standardMsg)
648648
raise self.failureException(msg)
649649

650-
def assertNotAlmostEqual(self, first, second, *, places=7, msg=None):
650+
def assertNotAlmostEqual(self, first, second, places=7, msg=None):
651651
"""Fail if the two objects are equal as determined by their
652652
difference rounded to the given number of decimal places
653653
(default 7) and comparing to zero.

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ C-API
143143
Library
144144
-------
145145

146+
- The keyword only restriction for the places argument in
147+
unittest.TestCase.assert[Not]AlmostEqual methods has been removed.
148+
146149
- Issue 6706: asyncore accept() method no longer raises EWOULDBLOCK/ECONNABORTED
147150
on incomplete connection attempt but returns None instead.
148151

0 commit comments

Comments
 (0)