diff options
-rw-r--r-- | test/farm/html/run_bom.py | 21 | ||||
-rw-r--r-- | test/farm/html/run_isolatin1.py | 2 | ||||
-rw-r--r-- | test/farm/html/src/bom.py | 11 |
3 files changed, 33 insertions, 1 deletions
diff --git a/test/farm/html/run_bom.py b/test/farm/html/run_bom.py new file mode 100644 index 00000000..918ad784 --- /dev/null +++ b/test/farm/html/run_bom.py @@ -0,0 +1,21 @@ +import sys + +def html_it(): + """Run coverage and make an HTML report for bom.py.""" + import coverage + cov = coverage.coverage() + cov.start() + import bom + cov.stop() + cov.html_report(bom, directory="../html_bom") + +runfunc(html_it, rundir="src") + +# HTML files will change often. Check that the sizes are reasonable, +# and check that certain key strings are in the output. +compare("gold_bom", "html_bom", size_within=10, file_pattern="*.html") +contains("html_bom/bom.html", + "<span class='str'>"3×4 = 12, ÷2 = 6±0"</span>", + ) + +clean("html_bom") diff --git a/test/farm/html/run_isolatin1.py b/test/farm/html/run_isolatin1.py index 3d4b23c5..9f4b8690 100644 --- a/test/farm/html/run_isolatin1.py +++ b/test/farm/html/run_isolatin1.py @@ -1,7 +1,7 @@ import sys def html_it(): - """Run coverage and make an HTML report for unicode.py.""" + """Run coverage and make an HTML report for isolatin1.py.""" import coverage cov = coverage.coverage() cov.start() diff --git a/test/farm/html/src/bom.py b/test/farm/html/src/bom.py new file mode 100644 index 00000000..2db8b717 --- /dev/null +++ b/test/farm/html/src/bom.py @@ -0,0 +1,11 @@ +# A python source file in utf-8, with BOM
+math = "3×4 = 12, ÷2 = 6±0"
+ +import sys
+
+if sys.version_info >= (3, 0):
+ assert len(math) == 18
+ assert len(math.encode('utf-8')) == 21
+else:
+ assert len(math) == 21
+ assert len(math.decode('utf-8')) == 18
|