Browse Source

Skipping this test for Python 2 for now.

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.2
julienmalard 4 years ago
parent
commit
02c39a84db
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      tests/test_reconstructor.py

+ 6
- 6
tests/test_reconstructor.py View File

@@ -1,19 +1,22 @@
# coding=utf-8

import json
import sys
import unittest
from unittest import TestCase

from lark import Lark
from lark.reconstruct import Reconstructor


common = """
%import common (WS_INLINE, NUMBER, WORD)
%ignore WS_INLINE
"""


def _remove_ws(s):
return s.replace(' ', '').replace('\n','')
return s.replace(' ', '').replace('\n', '')


class TestReconstructor(TestCase):

@@ -24,7 +27,6 @@ class TestReconstructor(TestCase):
self.assertEqual(_remove_ws(code), _remove_ws(new))

def test_starred_rule(self):

g = """
start: item*
item: NL
@@ -40,7 +42,6 @@ class TestReconstructor(TestCase):
self.assert_reconstruct(g, code)

def test_starred_group(self):

g = """
start: (rule | NL)*
rule: WORD ":" NUMBER
@@ -54,7 +55,6 @@ class TestReconstructor(TestCase):
self.assert_reconstruct(g, code)

def test_alias(self):

g = """
start: line*
line: NL
@@ -142,6 +142,7 @@ class TestReconstructor(TestCase):
new_json = Reconstructor(json_parser).reconstruct(tree)
self.assertEqual(json.loads(new_json), json.loads(test_json))

@unittest.skipIf(sys.version_info < (3, 0), "Python 2 does not play well with Unicode.")
def test_switch_grammar_unicode_terminal(self):
"""
This test checks that a parse tree built with a grammar containing only ascii characters can be reconstructed
@@ -179,6 +180,5 @@ class TestReconstructor(TestCase):
assert l2.parse(code2) == tree



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

Loading…
Cancel
Save