Explorar el Código

Add test for UTF-8 characters in grammar

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

+ 14
- 0
tests/test_parser.py Ver fichero

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import unittest
@@ -53,6 +54,19 @@ class TestParsers(unittest.TestCase):
l = Lark(g, parser='earley', lexer='dynamic')
self.assertRaises(ParseError, l.parse, 'a')

def test_utf8(self):
g = """start: a
a: "±a"
"""
l = Lark(g)
l.parse('±a')

l = Lark(g, parser='earley', lexer=None)
l.parse('±a')

l = Lark(g, parser='earley', lexer='dynamic')
l.parse('±a')


def _make_full_earley_test(LEXER):
class _TestFullEarley(unittest.TestCase):


Cargando…
Cancelar
Guardar