summaryrefslogtreecommitdiff
path: root/tests/test_plugins.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-01-07 05:48:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-01-07 05:48:14 -0500
commitbcd79d771331e3552571caf843d4e417ff886cd9 (patch)
treeb360a52ba50e80c565a802cbebf34390be469be4 /tests/test_plugins.py
parentf28be718d6214b18df559e39ef223418782436d7 (diff)
downloadpython-coveragepy-git-bcd79d771331e3552571caf843d4e417ff886cd9.tar.gz
refactor(test): use math.isclose to check float values
Diffstat (limited to 'tests/test_plugins.py')
-rw-r--r--tests/test_plugins.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 2140f00c..45b3bc9e 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -5,6 +5,7 @@
import inspect
import io
+import math
import os.path
from xml.etree import ElementTree
@@ -426,7 +427,7 @@ class GoodFileTracerTest(FileTracerTest):
'TOTAL 11 7 0 0 36%',
]
assert expected == report
- assert round(abs(total-36.36), 2) == 0
+ assert math.isclose(total, 4 / 11 * 100)
def test_plugin2_with_html_report(self):
self.make_render_and_caller()
@@ -437,7 +438,7 @@ class GoodFileTracerTest(FileTracerTest):
self.start_import_stop(cov, "caller")
total = cov.html_report(include=["*.html"], omit=["uni*.html"])
- assert round(abs(total-36.36), 2) == 0
+ assert math.isclose(total, 4 / 11 * 100)
self.assert_exists("htmlcov/index.html")
self.assert_exists("htmlcov/bar_4_html.html")
@@ -452,7 +453,7 @@ class GoodFileTracerTest(FileTracerTest):
self.start_import_stop(cov, "caller")
total = cov.xml_report(include=["*.html"], omit=["uni*.html"])
- assert round(abs(total-36.36), 2) == 0
+ assert math.isclose(total, 4 / 11 * 100)
dom = ElementTree.parse("coverage.xml")
classes = {}