This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

32 行
625 B

  1. from __future__ import absolute_import
  2. import sys
  3. from unittest import TestCase, main
  4. from lark import Lark
  5. from lark.load_grammar import GrammarLoader, GrammarError
  6. class TestGrammar(TestCase):
  7. def setUp(self):
  8. pass
  9. def test_errors(self):
  10. for msg, examples in GrammarLoader.ERRORS:
  11. for example in examples:
  12. try:
  13. p = Lark(example)
  14. except GrammarError as e:
  15. assert msg in str(e)
  16. else:
  17. assert False, "example did not raise an error"
  18. if __name__ == '__main__':
  19. main()