test_hyphen_at_line_end.py 679 B

12345678910111213141516171819202122232425262728
  1. from magic_pdf.dict2md.ocr_mkcontent import __is_hyphen_at_line_end
  2. def test_hyphen_at_line_end():
  3. """
  4. 测试行尾是不是一个连字符
  5. """
  6. test_cases_ok = [
  7. "I am zhang-",
  8. "you are zhang- ",
  9. "math-",
  10. "This is a TEST-",
  11. "This is a TESTing-",
  12. "美国人 hello-",
  13. ]
  14. test_cases_bad = [
  15. "This is a TEST$-",
  16. "This is a TEST21-",
  17. "中国人-",
  18. "美国人 hello人-",
  19. "this is 123-",
  20. ]
  21. for test_case in test_cases_ok:
  22. assert __is_hyphen_at_line_end(test_case)
  23. for test_case in test_cases_bad:
  24. assert not __is_hyphen_at_line_end(test_case)