Browse Source

Added regex tests to tox.

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.9.0
julienmalard 4 years ago
parent
commit
857f71e3aa
2 changed files with 5 additions and 1 deletions
  1. +1
    -1
      tests/__main__.py
  2. +4
    -0
      tests/test_regex.py

+ 1
- 1
tests/__main__.py View File

@@ -7,7 +7,7 @@ from .test_trees import TestTrees
from .test_tools import TestStandalone
from .test_cache import TestCache
from .test_reconstructor import TestReconstructor
from .test_regex import TestRegex
try:
from .test_nearley.test_nearley import TestNearley
except ImportError:


+ 4
- 0
tests/test_regex.py View File

@@ -2,6 +2,7 @@
from __future__ import absolute_import

import logging
import sys
import unittest

logging.basicConfig(level=logging.INFO)
@@ -10,8 +11,10 @@ from lark.lark import Lark


class TestRegex(unittest.TestCase):
@unittest.skipIf(sys.version_info[0] == 2, 'Unicode and Python 2 do not place nicely together.')
def test_unicode_class(self):
"Tests that character classes from the `regex` module work correctly."
print(sys.version_info)
g = Lark(r"""
?start: NAME
NAME: ID_START ID_CONTINUE*
@@ -21,6 +24,7 @@ class TestRegex(unittest.TestCase):

self.assertEqual(g.parse('வணக்கம்'), 'வணக்கம்')

@unittest.skipIf(sys.version_info[0] == 2, 'Unicode and Python 2 do not place nicely together.')
def test_unicode_word(self):
"Tests that a persistent bug in the `re` module works when `regex` is enabled."
g = Lark(r"""


Loading…
Cancel
Save