summaryrefslogtreecommitdiff
path: root/tests/test_html.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-20 18:46:18 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-11-20 19:36:58 -0500
commit7345085c3983f5f7d05f64da1af8e43da3dc5639 (patch)
tree1bd9d3338bf0a3df09da86b5b874c1d9c5997f2d /tests/test_html.py
parente2c8f9c7bcf42b9210adbdb28b073fdda14be0d3 (diff)
downloadpython-coveragepy-git-7345085c3983f5f7d05f64da1af8e43da3dc5639.tar.gz
refactor(test): move unicode handling tests to individual test files
Eight fewer sub-processes
Diffstat (limited to 'tests/test_html.py')
-rw-r--r--tests/test_html.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
index 622f2d2f..cb222270 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -1031,6 +1031,33 @@ assert len(math) == 18
'<span class="str">"db40,dd00: x&#917760;"</span>',
)
+ def test_accented_dot_py(self):
+ # Make a file with a non-ascii character in the filename.
+ self.make_file("h\xe2t.py", "print('accented')")
+ self.make_data_file(lines={abs_file("h\xe2t.py"): [1]})
+ cov = coverage.Coverage()
+ cov.load()
+ cov.html_report()
+ self.assert_exists("htmlcov/h\xe2t_py.html")
+ with open("htmlcov/index.html") as indexf:
+ index = indexf.read()
+ assert '<a href="h&#226;t_py.html">h&#226;t.py</a>' in index
+
+ def test_accented_directory(self):
+ # Make a file with a non-ascii character in the directory name.
+ self.make_file("\xe2/accented.py", "print('accented')")
+ self.make_data_file(lines={abs_file("\xe2/accented.py"): [1]})
+
+ # The HTML report uses ascii-encoded HTML entities.
+ cov = coverage.Coverage()
+ cov.load()
+ cov.html_report()
+ self.assert_exists("htmlcov/d_5786906b6f0ffeb4_accented_py.html")
+ with open("htmlcov/index.html") as indexf:
+ index = indexf.read()
+ expected = '<a href="d_5786906b6f0ffeb4_accented_py.html">&#226;%saccented.py</a>'
+ assert expected % os.sep in index
+
class HtmlWithContextsTest(HtmlTestHelpers, CoverageTest):
"""Tests of the HTML reports with shown contexts."""