diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-10-15 16:28:20 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-10-15 16:28:20 (GMT) |
commit | e8f583244acd61d7ba43d0f98c06d57c25977039 (patch) | |
tree | 3cbdcba9f0121ade8913e07cd83c8ee324999de1 /Lib/test/encoded_modules | |
parent | c01537f742c3d2591016ef29bb20e3a26482be78 (diff) | |
download | cpython-e8f583244acd61d7ba43d0f98c06d57c25977039.zip cpython-e8f583244acd61d7ba43d0f98c06d57c25977039.tar.gz cpython-e8f583244acd61d7ba43d0f98c06d57c25977039.tar.bz2 |
Issue #9308: Removed redundant coding cookies. Added tests for
importing encoded modules that do not depend on specific stdlib
modules being encoded in a certain way.
Diffstat (limited to 'Lib/test/encoded_modules')
-rw-r--r-- | Lib/test/encoded_modules/__init__.py | 23 | ||||
-rw-r--r-- | Lib/test/encoded_modules/module_iso_8859_1.py | 5 | ||||
-rw-r--r-- | Lib/test/encoded_modules/module_koi8_r.py | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/encoded_modules/__init__.py b/Lib/test/encoded_modules/__init__.py new file mode 100644 index 0000000..ec43252 --- /dev/null +++ b/Lib/test/encoded_modules/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- + +# This is a package that contains a number of modules that are used to +# test import from the source files that have different encodings. +# This file (the __init__ module of the package), is encoded in utf-8 +# and contains a list of strings from various unicode planes that are +# encoded differently to compare them to the same strings encoded +# differently in submodules. The following list, test_strings, +# contains a list of tuples. The first element of each tuple is the +# suffix that should be prepended with 'module_' to arrive at the +# encoded submodule name, the second item is the encoding and the last +# is the test string. The same string is assigned to the variable +# named 'test' inside the submodule. If the decoding of modules works +# correctly, from module_xyz import test should result in the same +# string as listed below in the 'xyz' entry. + +# module, encoding, test string +test_strings = ( + ('iso_8859_1', 'iso-8859-1', "Les hommes ont oublié cette vérité, " + "dit le renard. Mais tu ne dois pas l'oublier. Tu deviens " + "responsable pour toujours de ce que tu as apprivoisé."), + ('koi8_r', 'koi8-r', "Познание бесконечности требует бесконечного времени.") +) diff --git a/Lib/test/encoded_modules/module_iso_8859_1.py b/Lib/test/encoded_modules/module_iso_8859_1.py new file mode 100644 index 0000000..8f4a15c --- /dev/null +++ b/Lib/test/encoded_modules/module_iso_8859_1.py @@ -0,0 +1,5 @@ +# test iso-8859-1 encoding +# -*- encoding: iso-8859-1 -*- +test = ("Les hommes ont oubli cette vrit, " + "dit le renard. Mais tu ne dois pas l'oublier. Tu deviens " + "responsable pour toujours de ce que tu as apprivois.") diff --git a/Lib/test/encoded_modules/module_koi8_r.py b/Lib/test/encoded_modules/module_koi8_r.py new file mode 100644 index 0000000..9b23a5a --- /dev/null +++ b/Lib/test/encoded_modules/module_koi8_r.py @@ -0,0 +1,3 @@ +# test koi8-r encoding +# -*- encoding: koi8-r -*- +test = " ." |