summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-07-02 11:18:40 (GMT)
committerGitHub <noreply@github.com>2019-07-02 11:18:40 (GMT)
commit518dc94e423398f7b0b5fd7bd5b84f138618e68e (patch)
treec539734408628160870be80917731c952f1d931d
parentbd92b94da93198c8385c06ca908407f172c7e8b2 (diff)
downloadcpython-518dc94e423398f7b0b5fd7bd5b84f138618e68e.zip
cpython-518dc94e423398f7b0b5fd7bd5b84f138618e68e.tar.gz
cpython-518dc94e423398f7b0b5fd7bd5b84f138618e68e.tar.bz2
bpo-37335, test_c_locale_coercion: Remove unnecessary code (GH-14447)
Python initialization now ensures that sys stream encoding names are always normalized by codecs.lookup(encoding).name. Simplify test_c_locale_coercion: it doesn't have to normalize encoding names anymore. (cherry picked from commit 61bf97e91620e020939d57a36918ab22579920ff) Co-authored-by: Jakub KulĂ­k <Kulikjak@gmail.com>
-rw-r--r--Lib/test/test_c_locale_coercion.py24
-rw-r--r--Misc/NEWS.d/next/Tests/2019-06-28-16-37-52.bpo-37335.o5S2hY.rst1
2 files changed, 6 insertions, 19 deletions
diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py
index 8149e2b..fb599b0 100644
--- a/Lib/test/test_c_locale_coercion.py
+++ b/Lib/test/test_c_locale_coercion.py
@@ -116,28 +116,15 @@ class EncodingDetails(_EncodingDetails):
stream_info = 2*[_stream.format("surrogateescape")]
# stderr should always use backslashreplace
stream_info.append(_stream.format("backslashreplace"))
- expected_lang = env_vars.get("LANG", "not set").lower()
+ expected_lang = env_vars.get("LANG", "not set")
if coercion_expected:
- expected_lc_ctype = CLI_COERCION_TARGET.lower()
+ expected_lc_ctype = CLI_COERCION_TARGET
else:
- expected_lc_ctype = env_vars.get("LC_CTYPE", "not set").lower()
- expected_lc_all = env_vars.get("LC_ALL", "not set").lower()
+ expected_lc_ctype = env_vars.get("LC_CTYPE", "not set")
+ expected_lc_all = env_vars.get("LC_ALL", "not set")
env_info = expected_lang, expected_lc_ctype, expected_lc_all
return dict(cls(fs_encoding, *stream_info, *env_info)._asdict())
- @staticmethod
- def _handle_output_variations(data):
- """Adjust the output to handle platform specific idiosyncrasies
-
- * Some platforms report ASCII as ANSI_X3.4-1968
- * Some platforms report ASCII as US-ASCII
- * Some platforms report UTF-8 instead of utf-8
- """
- data = data.replace(b"ANSI_X3.4-1968", b"ascii")
- data = data.replace(b"US-ASCII", b"ascii")
- data = data.lower()
- return data
-
@classmethod
def get_child_details(cls, env_vars):
"""Retrieves fsencoding and standard stream details from a child process
@@ -157,8 +144,7 @@ class EncodingDetails(_EncodingDetails):
if not result.rc == 0:
result.fail(py_cmd)
# All subprocess outputs in this test case should be pure ASCII
- adjusted_output = cls._handle_output_variations(result.out)
- stdout_lines = adjusted_output.decode("ascii").splitlines()
+ stdout_lines = result.out.decode("ascii").splitlines()
child_encoding_details = dict(cls(*stdout_lines)._asdict())
stderr_lines = result.err.decode("ascii").rstrip().splitlines()
return child_encoding_details, stderr_lines
diff --git a/Misc/NEWS.d/next/Tests/2019-06-28-16-37-52.bpo-37335.o5S2hY.rst b/Misc/NEWS.d/next/Tests/2019-06-28-16-37-52.bpo-37335.o5S2hY.rst
new file mode 100644
index 0000000..cb884d9
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2019-06-28-16-37-52.bpo-37335.o5S2hY.rst
@@ -0,0 +1 @@
+Remove no longer necessary code from c locale coercion tests