From 78597a8554fe563261d7d59c580d7c5b6ed6e055 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 24 Feb 2017 03:34:16 -0800 Subject: [PATCH] Add hebrew and chinese --- tests/test_locale/פטכש/__init__.py | 0 tests/test_locale/פטכש/test_codec.py | 30 ++++++++++++++++++++++++++++ tests/test_locale/פטכש/testcodec | 1 + tests/test_locale/测试/__init__.py | 0 tests/test_locale/测试/test_codec.py | 30 ++++++++++++++++++++++++++++ tests/test_locale/测试/testcodec | 1 + 6 files changed, 62 insertions(+) create mode 100644 tests/test_locale/פטכש/__init__.py create mode 100644 tests/test_locale/פטכש/test_codec.py create mode 100644 tests/test_locale/פטכש/testcodec create mode 100644 tests/test_locale/测试/__init__.py create mode 100644 tests/test_locale/测试/test_codec.py create mode 100644 tests/test_locale/测试/testcodec diff --git a/tests/test_locale/פטכש/__init__.py b/tests/test_locale/פטכש/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_locale/פטכש/test_codec.py b/tests/test_locale/פטכש/test_codec.py new file mode 100644 index 000000000..d8a716621 --- /dev/null +++ b/tests/test_locale/פטכש/test_codec.py @@ -0,0 +1,30 @@ +# Hebrew + +import os +import platform +from tests.test_locale.locale_functions import GetPath + + +def test_codec(): + use_codec = { + "Windows": "cp1252", + "Linux" : "utf8", + "Darwin" : "utf8", + } + + os_name = platform.system() + current_directory = os.path.dirname(os.path.abspath(__file__)) + + try: + decoded_file = GetPath(current_directory, "testcodec", use_codec[os_name]) + except: + assert False, "Specified codec (" + use_codec[os_name] + ") failed to decrypt file path." + + try: + with open(decoded_file, 'r') as f: + read_data = f.read() + f.closed + except: + assert False, "Specified codec (" + use_codec[os_name] + ") failed to read file." + + assert read_data == "True" diff --git a/tests/test_locale/פטכש/testcodec b/tests/test_locale/פטכש/testcodec new file mode 100644 index 000000000..4791ed555 --- /dev/null +++ b/tests/test_locale/פטכש/testcodec @@ -0,0 +1 @@ +True \ No newline at end of file diff --git a/tests/test_locale/测试/__init__.py b/tests/test_locale/测试/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_locale/测试/test_codec.py b/tests/test_locale/测试/test_codec.py new file mode 100644 index 000000000..f72f2e0cb --- /dev/null +++ b/tests/test_locale/测试/test_codec.py @@ -0,0 +1,30 @@ +# Chinese (Simplified) + +import os +import platform +from tests.test_locale.locale_functions import GetPath + + +def test_codec(): + use_codec = { + "Windows": "cp1252", + "Linux" : "utf8", + "Darwin" : "utf8", + } + + os_name = platform.system() + current_directory = os.path.dirname(os.path.abspath(__file__)) + + try: + decoded_file = GetPath(current_directory, "testcodec", use_codec[os_name]) + except: + assert False, "Specified codec (" + use_codec[os_name] + ") failed to decrypt file path." + + try: + with open(decoded_file, 'r') as f: + read_data = f.read() + f.closed + except: + assert False, "Specified codec (" + use_codec[os_name] + ") failed to read file." + + assert read_data == "True" diff --git a/tests/test_locale/测试/testcodec b/tests/test_locale/测试/testcodec new file mode 100644 index 000000000..4791ed555 --- /dev/null +++ b/tests/test_locale/测试/testcodec @@ -0,0 +1 @@ +True \ No newline at end of file