This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 rivejä
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()