summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-05-14 02:41:09 -0500
committerptmcg <ptmcg@austin.rr.com>2022-05-14 02:41:09 -0500
commitfc7c76b6c7f1e876a11e4df6d29212738c2ba723 (patch)
treea6459d8a1f7d65930b46858c9d8d18badf5139c5 /tests
parent01969ff3dd0e52a7cc104a5f231d4f370bde4a98 (diff)
downloadpyparsing-git-fc7c76b6c7f1e876a11e4df6d29212738c2ba723.tar.gz
Fixed bug in srange (escaped chars inside range set); fixed ignore type annotation in SkipTo
Diffstat (limited to 'tests')
-rw-r--r--tests/test_diagram.py26
-rw-r--r--tests/test_unit.py2
2 files changed, 22 insertions, 6 deletions
diff --git a/tests/test_diagram.py b/tests/test_diagram.py
index 77d0f92..eeef20e 100644
--- a/tests/test_diagram.py
+++ b/tests/test_diagram.py
@@ -56,19 +56,25 @@ class TestRailroadDiagrams(unittest.TestCase):
def test_json(self):
railroad = self.generate_railroad(jsonObject, "jsonObject")
assert len(railroad) == 9
- railroad = self.generate_railroad(jsonObject, "jsonObject", show_results_names=True)
+ railroad = self.generate_railroad(
+ jsonObject, "jsonObject", show_results_names=True
+ )
assert len(railroad) == 9
def test_sql(self):
railroad = self.generate_railroad(simpleSQL, "simpleSQL")
assert len(railroad) == 18
- railroad = self.generate_railroad(simpleSQL, "simpleSQL", show_results_names=True)
+ railroad = self.generate_railroad(
+ simpleSQL, "simpleSQL", show_results_names=True
+ )
assert len(railroad) == 18
def test_calendars(self):
railroad = self.generate_railroad(calendars, "calendars")
assert len(railroad) == 13
- railroad = self.generate_railroad(calendars, "calendars", show_results_names=True)
+ railroad = self.generate_railroad(
+ calendars, "calendars", show_results_names=True
+ )
assert len(railroad) == 13
def test_nested_forward_with_inner_and_outer_names(self):
@@ -78,7 +84,9 @@ class TestRailroadDiagrams(unittest.TestCase):
railroad = self.generate_railroad(outer, "inner_outer_names")
assert len(railroad) == 2
- railroad = self.generate_railroad(outer, "inner_outer_names", show_results_names=True)
+ railroad = self.generate_railroad(
+ outer, "inner_outer_names", show_results_names=True
+ )
assert len(railroad) == 2
def test_nested_forward_with_inner_name_only(self):
@@ -102,7 +110,9 @@ class TestRailroadDiagrams(unittest.TestCase):
).setName("int-word-uuid in any order")
railroad = self.generate_railroad(grammar, "each_expression")
assert len(railroad) == 2
- railroad = self.generate_railroad(grammar, "each_expression", show_results_names=True)
+ railroad = self.generate_railroad(
+ grammar, "each_expression", show_results_names=True
+ )
assert len(railroad) == 2
def test_none_name(self):
@@ -122,7 +132,11 @@ class TestRailroadDiagrams(unittest.TestCase):
def test_complete_combine_element(self):
ints = pp.Word(pp.nums)
grammar = pp.Combine(
- ints('hours') + pp.Literal(":") + ints('minutes') + pp.Literal(":") + ints('seconds')
+ ints("hours")
+ + pp.Literal(":")
+ + ints("minutes")
+ + pp.Literal(":")
+ + ints("seconds")
)
railroad = to_railroad(grammar)
assert len(railroad) == 1
diff --git a/tests/test_unit.py b/tests/test_unit.py
index 59fab7b..e11524f 100644
--- a/tests/test_unit.py
+++ b/tests/test_unit.py
@@ -1455,6 +1455,7 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase):
r"[\0xa1-\0xbf\0xd7\0xf7]",
r"[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]",
r"[\0xa1-\0xbf\0xd7\0xf7]",
+ r"[\\[\]\/\-\*\.\$\+\^\?()~ ]",
)
expectedResults = (
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
@@ -1482,6 +1483,7 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase):
"¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿×÷",
pp.alphas8bit,
pp.punc8bit,
+ r"\[]/-*.$+^?()~ ",
)
for test in zip(testCases, expectedResults):
t, exp = test