diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-10-22 16:07:09 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-10-22 16:07:09 -0500 |
commit | 05b777b9c087da69603069865b13a87198e8f071 (patch) | |
tree | f2346c20d3098afe209f808ddffeee053c06cb04 /tests | |
parent | f437babe086e5f76dab79378c0f92ff0067dff94 (diff) | |
download | pyparsing-git-05b777b9c087da69603069865b13a87198e8f071.tar.gz |
Guard against empty ParseExpressions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_unit.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_unit.py b/tests/test_unit.py index b4362d3..ca9b474 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -8484,6 +8484,14 @@ class Test02_WithoutPackrat(ppt.TestParseResultsAsserts, TestCase): print(expr) self.assertEqual("(0-9)", repr(expr)) + def testEmptyExpressionsAreHandledProperly(self): + from pyparsing.diagram import to_railroad + for cls in (pp.And, pp.Or, pp.MatchFirst, pp.Each): + print("testing empty", cls.__name__) + expr = cls([]) + expr.streamline() + to_railroad(expr) + class Test03_EnablePackratParsing(TestCase): def runTest(self): |