From 7d21c754a12eccbe5cc842c5831bc2c3d7bae68f Mon Sep 17 00:00:00 2001 From: Kaspar Emanuel Date: Sun, 15 Oct 2017 18:27:55 +0100 Subject: [PATCH] Add test for UTF-8 characters in grammar --- tests/test_parser.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index 9fa05eb..d29aa47 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -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):