This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

32 rindas
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()