diff options
author | ptmcg <ptmcg@austin.rr.com> | 2018-09-17 22:19:59 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2018-09-17 22:19:59 -0500 |
commit | 65ebd34d1b015f084efde0c67206d69076df541b (patch) | |
tree | 690c3d2a65c028ab958df74ed362adc89aa7ac46 /unitTests.py | |
parent | da477061dfae8aa92f56ec48ef987e266504542e (diff) | |
download | pyparsing-git-65ebd34d1b015f084efde0c67206d69076df541b.tar.gz |
Stage for 2.2.1 release; add Getting Started section to module docstring; fix Literal/Keyword index error bug
Diffstat (limited to 'unitTests.py')
-rw-r--r-- | unitTests.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/unitTests.py b/unitTests.py index 2bc7da7..a31bf40 100644 --- a/unitTests.py +++ b/unitTests.py @@ -4,7 +4,7 @@ #
# Unit tests for pyparsing module
#
-# Copyright 2002-2016, Paul McGuire
+# Copyright 2002-2018, Paul McGuire
#
#
from unittest import TestCase, TestSuite, TextTestRunner
@@ -3395,6 +3395,19 @@ class ColTest(ParseTestCase): print_(initials)
assert len(initials) == 4 and all(c=='*' for c in initials), 'fail col test'
+class LiteralExceptionTest(ParseTestCase):
+ def runTest(self):
+ import pyparsing as pp
+
+ for cls in (pp.Literal, pp.CaselessLiteral, pp.Keyword, pp.CaselessKeyword,
+ pp.Word, pp.Regex):
+ expr = cls('xyz')#.setName('{}_expr'.format(cls.__name__.lower()))
+
+ try:
+ expr.parseString(' ')
+ except Exception as e:
+ print(cls.__name__, str(e))
+ assert isinstance(e, pp.ParseBaseException), "class {} raised wrong exception type {}".format(cls.__name__, type(e).__name__)
class MiscellaneousParserTests(ParseTestCase):
def runTest(self):
|