]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#18663: document that assertAlmostEqual also works when the values are equal and...
authorEzio Melotti <ezio.melotti@gmail.com>
Sun, 11 Aug 2013 10:04:50 +0000 (13:04 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Sun, 11 Aug 2013 10:04:50 +0000 (13:04 +0300)
Doc/library/unittest.rst
Lib/unittest/test/test_assertions.py

index 1bd3819bc2d7f9ddee6851f7604219a583112a41..f36a44deccfc902678ab05d2bf08a1bfe99f6514 100644 (file)
@@ -1017,7 +1017,7 @@ Test cases
       like the :func:`round` function) and not *significant digits*.
 
       If *delta* is supplied instead of *places* then the difference
-      between *first* and *second* must be less (or more) than *delta*.
+      between *first* and *second* must be less or equal to (or greater than) *delta*.
 
       Supplying both *delta* and *places* raises a ``TypeError``.
 
index e1ba61470664be6dfc49badb6b279246117c3404..e8f0f64b4cf91ac0031c3df90e1849b9e158e3b3 100644 (file)
@@ -33,6 +33,10 @@ class Test_Assertions(unittest.TestCase):
         self.assertNotAlmostEqual(1.1, 1.0, delta=0.05)
         self.assertNotAlmostEqual(1.0, 1.1, delta=0.05)
 
+        self.assertAlmostEqual(1.0, 1.0, delta=0.5)
+        self.assertRaises(self.failureException, self.assertNotAlmostEqual,
+                          1.0, 1.0, delta=0.5)
+
         self.assertRaises(self.failureException, self.assertAlmostEqual,
                           1.1, 1.0, delta=0.05)
         self.assertRaises(self.failureException, self.assertNotAlmostEqual,