Skip to content

Commit

Permalink
✅ test(test_translator): add unit test for BaseTranslator
Browse files Browse the repository at this point in the history
- implement test to ensure BaseTranslator raises NotImplementedError
- verify that the translate method is not implemented for base class
  • Loading branch information
awwaawwa committed Dec 23, 2024
1 parent 28e5f94 commit 97e9a90
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 97e9a90

Please sign in to comment.