clarify documentation about tolerance setting in unittest.TestCase.assertAlmost() (#8614)

This commit is contained in:
Rahul Kumaresan 2021-05-05 17:53:39 +05:30 committed by GitHub
parent adc197424d
commit 245eefafcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -640,10 +640,9 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase:
- ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b`` - ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b``
are within an absolute tolerance of ``1e-7``. No relative tolerance is are within an absolute tolerance of ``1e-7``. No relative tolerance is
considered and the absolute tolerance cannot be changed, so this function considered , so this function is not appropriate for very large or very
is not appropriate for very large or very small numbers. Also, it's only small numbers. Also, it's only available in subclasses of ``unittest.TestCase``
available in subclasses of ``unittest.TestCase`` and it's ugly because it and it's ugly because it doesn't follow PEP8. `More information...`__
doesn't follow PEP8. `More information...`__
__ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual __ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual