summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-16 21:00:59 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-16 21:00:59 -0400
commitc731debc01e436609b73248f6dfd9581d039fc1a (patch)
tree709e551020ff2b6dd2a12e081fb14a1053e74204 /tests
parent9f269ac30b46038ee1fec1c89fb5b5fef5ce6678 (diff)
downloadpython-coveragepy-c731debc01e436609b73248f6dfd9581d039fc1a.tar.gz
Do a better job decoding source files. #431
Diffstat (limited to 'tests')
-rw-r--r--tests/test_phystokens.py12
-rw-r--r--tests/test_python.py2
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_phystokens.py b/tests/test_phystokens.py
index b4a106f..7bdece7 100644
--- a/tests/test_phystokens.py
+++ b/tests/test_phystokens.py
@@ -8,7 +8,7 @@ import re
from coverage import env
from coverage.phystokens import source_token_lines, source_encoding
-from coverage.phystokens import neuter_encoding_declaration
+from coverage.phystokens import neuter_encoding_declaration, compile_unicode
from coverage.python import get_python_source
from tests.coveragetest import CoverageTest
@@ -165,3 +165,13 @@ class NeuterEncodingDeclarationTest(CoverageTest):
DEF_ENCODING,
"Wrong encoding in %r" % neutered
)
+
+
+class CompileUnicodeTest(CoverageTest):
+ """Tests of compiling Unicode strings."""
+
+ run_in_temp_dir = False
+
+ def test_cp1252(self):
+ uni = u"""# coding: cp1252\n# \u201C curly \u201D\n"""
+ compile_unicode(uni, "<string>", "exec")
diff --git a/tests/test_python.py b/tests/test_python.py
index e510e78..ee1e1f9 100644
--- a/tests/test_python.py
+++ b/tests/test_python.py
@@ -20,7 +20,7 @@ class GetZipBytesTest(CoverageTest):
# See igor.py, do_zipmods, for the text of these files.
zip_file = "tests/zipmods.zip"
sys.path.append(zip_file) # So we can import the files.
- for encoding in ["utf8", "gb2312", "hebrew", "shift_jis"]:
+ for encoding in ["utf8", "gb2312", "hebrew", "shift_jis", "cp1252"]:
filename = zip_file + "/encoded_" + encoding + ".py"
filename = filename.replace("/", os.sep)
zip_data = get_zip_bytes(filename)