From 6ca614a61e82f3b2eb0cb8994f53bcb57713beb0 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 21 Mar 2012 20:59:26 -0400 Subject: If a source file has an encoding declaration, use it when producing the HTML. Fixes issue #157. --- test/farm/html/gold_isolatin1/index.html | 89 +++++++++++++++++++++++++++ test/farm/html/gold_isolatin1/isolatin1.html | 91 ++++++++++++++++++++++++++++ test/farm/html/run_isolatin1.py | 21 +++++++ test/farm/html/src/isolatin1.py | 5 ++ 4 files changed, 206 insertions(+) create mode 100644 test/farm/html/gold_isolatin1/index.html create mode 100644 test/farm/html/gold_isolatin1/isolatin1.html create mode 100644 test/farm/html/run_isolatin1.py create mode 100644 test/farm/html/src/isolatin1.py (limited to 'test') diff --git a/test/farm/html/gold_isolatin1/index.html b/test/farm/html/gold_isolatin1/index.html new file mode 100644 index 00000000..6e9f3ca7 --- /dev/null +++ b/test/farm/html/gold_isolatin1/index.html @@ -0,0 +1,89 @@ + + + + + Coverage report + + + + + + + + + + + +
+ +

Hot-keys on this page

+
+

+ n + s + m + x + + c   change column sorting +

+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Modulestatementsmissingexcludedcoverage
Total200100%
isolatin1200100%
+
+ + + + + diff --git a/test/farm/html/gold_isolatin1/isolatin1.html b/test/farm/html/gold_isolatin1/isolatin1.html new file mode 100644 index 00000000..276a6c25 --- /dev/null +++ b/test/farm/html/gold_isolatin1/isolatin1.html @@ -0,0 +1,91 @@ + + + + + + + + Coverage for isolatin1: 100% + + + + + + + + + + + +
+ +

Hot-keys on this page

+
+

+ r + m + x + p   toggle line displays +

+

+ j + k   next/prev highlighted chunk +

+

+ 0   (zero) top of page +

+

+ 1   (one) first highlighted chunk +

+
+
+ +
+ + + + + +
+

1

+

2

+

3

+

4

+

5

+ +
+

# A python source file in another encoding. 

+

# -*- coding: iso8859-1 -*- 

+

 

+

math = "3×4 = 12, ÷2 = 6±0" 

+

assert len(math) == 18 

+ +
+
+ + + + + diff --git a/test/farm/html/run_isolatin1.py b/test/farm/html/run_isolatin1.py new file mode 100644 index 00000000..3d4b23c5 --- /dev/null +++ b/test/farm/html/run_isolatin1.py @@ -0,0 +1,21 @@ +import sys + +def html_it(): + """Run coverage and make an HTML report for unicode.py.""" + import coverage + cov = coverage.coverage() + cov.start() + import isolatin1 + cov.stop() + cov.html_report(isolatin1, directory="../html_isolatin1") + +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_isolatin1", "html_isolatin1", size_within=10, file_pattern="*.html") +contains("html_isolatin1/isolatin1.html", + ""3×4 = 12, ÷2 = 6±0"", + ) + +clean("html_isolatin1") diff --git a/test/farm/html/src/isolatin1.py b/test/farm/html/src/isolatin1.py new file mode 100644 index 00000000..057c097b --- /dev/null +++ b/test/farm/html/src/isolatin1.py @@ -0,0 +1,5 @@ +# A python source file in another encoding. +# -*- coding: iso8859-1 -*- + +math = "3×4 = 12, ÷2 = 6±0" +assert len(math) == 18 -- cgit v1.2.1