test02_transliteration.py 866 B

12345678910111213141516171819202122232425262728293031
  1. from unittest import TestCase
  2. from importlib import reload
  3. from os import environ
  4. from transliterator.trans import transliterate
  5. import transliterator.tables
  6. class TestScriptToRoman(TestCase):
  7. """
  8. Test S2R transliteration.
  9. TODO use a comprehensive sample table and report errors for unsupported
  10. languages.
  11. """
  12. def setUp(self):
  13. if "TXL_CONFIG_TABLE_DIR" in environ:
  14. del environ["TXL_CONFIG_TABLE_DIR"]
  15. reload(transliterator.tables)
  16. # import transliterator.tables
  17. def test_basic_chinese(self):
  18. breakpoint()
  19. src = "撞倒須彌 : 漢傳佛教青年學者論壇論文集"
  20. dest = (
  21. "Zhuang dao Xumi : han zhuan Fo jiao qing nian xue zhe lun "
  22. "tan lun wen ji")
  23. trans = transliterate(src, "chinese")
  24. assert trans == dest