]> granicus.if.org Git - python/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 845bf0a2958cd5045f5ca186484e1b4bee04aa6b..0c00a261c4429b33c649ff4c7bb838dbafaa0d70 100644 (file)
@@ -1000,7 +1000,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 d43fe5a601bdfeca81cae0a38e35a79ce9111b51..7931cadaf3d94391ac1cfa54829feacc4d5d7545 100644 (file)
@@ -34,6 +34,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,