From 97e9a90c31292fb9b898707439a017f0b33bfcbc Mon Sep 17 00:00:00 2001 From: awwaawwa <8493196+awwaawwa@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test(test=5Ftranslator):=20add=20un?= =?UTF-8?q?it=20test=20for=20BaseTranslator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - implement test to ensure BaseTranslator raises NotImplementedError - verify that the translate method is not implemented for base class --- test/test_translator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test_translator.py b/test/test_translator.py index d7e69949..44526ddd 100644 --- a/test/test_translator.py +++ b/test/test_translator.py @@ -67,6 +67,11 @@ def test_add_cache_impact_parameters(self): another_result = translator.translate(text) self.assertNotEqual(second_result, another_result) + def test_base_translator_throw(self): + translator = BaseTranslator("en", "zh", "test") + with self.assertRaises(NotImplementedError): + translator.translate("Hello World") + if __name__ == "__main__": unittest.main()