From 6e3f1d2e26b6b757cd44beddf13737b1ec19aed0 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 16 Feb 2020 21:40:54 +1000 Subject: [PATCH] Revert "test out the Python Fluent implementation" This reverts commit 181c17a0988cf9e57b2604746000c6072cb96206. Reverting this to keep as a record. --- pylib/setup.py | 1 - pylib/tests/test_collection.py | 38 ++++------------------------------ 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/pylib/setup.py b/pylib/setup.py index 9462d2542..ffb93affd 100644 --- a/pylib/setup.py +++ b/pylib/setup.py @@ -23,6 +23,5 @@ setuptools.setup( "protobuf", 'psutil; sys_platform == "win32"', 'distro; sys_platform != "darwin" and sys_platform != "win32"', - "fluent.runtime", ], ) diff --git a/pylib/tests/test_collection.py b/pylib/tests/test_collection.py index 3fc58c44d..623e16181 100644 --- a/pylib/tests/test_collection.py +++ b/pylib/tests/test_collection.py @@ -158,37 +158,7 @@ def test_translate(): def no_uni(s: str) -> str: return s.replace("\u2068", "").replace("\u2069", "") - def test_backend(): - assert tr(StringsGroup.TEST, "valid-key") == "a valid key" - assert "invalid-key" in tr(StringsGroup.TEST, "invalid-key") - assert no_uni(tr(StringsGroup.TEST, "plural", hats=1)) == "You have 1 hat." - assert no_uni(tr(StringsGroup.TEST, "plural", hats=2)) == "You have 2 hats." - - import time - t = time.time() - test_backend() - print(time.time() - t) - - from fluent.runtime import FluentBundle, FluentResource - - test_path = os.path.join( - os.path.dirname(__file__), "../../rslib/tests/support/test.ftl" - ) - - def python_render(bundle, key, **kwargs): - try: - return bundle.format_pattern(bundle.get_message(key).value, kwargs)[0] - except: - return f"Missing key: {key}" - - def test_python(): - bundle = FluentBundle(["en-US"]) - bundle.add_resource(FluentResource(open(test_path).read())) - assert python_render(bundle, "valid-key") == "a valid key" - assert "invalid-key" in python_render(bundle, "invalid-key") - assert no_uni(python_render(bundle, "plural", hats=1)) == "You have 1 hat." - assert no_uni(python_render(bundle, "plural", hats=2)) == "You have 2 hats." - - t = time.time() - test_python() - print(time.time() - t) + assert tr(StringsGroup.TEST, "valid-key") == "a valid key" + assert "invalid-key" in tr(StringsGroup.TEST, "invalid-key") + assert no_uni(tr(StringsGroup.TEST, "plural", hats=1)) == "You have 1 hat." + assert no_uni(tr(StringsGroup.TEST, "plural", hats=2)) == "You have 2 hats."