Explorar el Código

Write test for nearley include

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.1
Kaspar Emanuel hace 7 años
padre
commit
21ecd9a319
Se han modificado 1 ficheros con 13 adiciones y 0 borrados
  1. +13
    -0
      tests/test_nearley/test_nearley.py

+ 13
- 0
tests/test_nearley/test_nearley.py Ver fichero

@@ -65,6 +65,19 @@ class TestNearley(unittest.TestCase):
assert c['g'] == 178
assert c['b'] == 3

def test_include(self):
fn = os.path.join(NEARLEY_PATH, 'test/grammars/folder-test.ne')
with open(fn) as f:
grammar = f.read()

code = create_code_for_nearley_grammar(grammar, 'main', BUILTIN_PATH, os.path.dirname(fn))
d = {}
exec (code, d)
parse = d['parse']

parse('a')
parse('b')


if __name__ == '__main__':
unittest.main()

Cargando…
Cancelar
Guardar