diff options
author | ptmcg <ptmcg@austin.rr.com> | 2018-10-07 13:29:00 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2018-10-07 13:29:00 -0500 |
commit | dc074e25459062578e9104dda3e86b662715f966 (patch) | |
tree | 90e7da431282f14d994d809a4d6b4db744230f5e /unitTests.py | |
parent | 6c98d20bd25fb34af629847c94f3283c28d1a4ab (diff) | |
download | pyparsing-git-dc074e25459062578e9104dda3e86b662715f966.tar.gz |
Better description of bug and fix for Issue #22
Diffstat (limited to 'unitTests.py')
-rw-r--r-- | unitTests.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/unitTests.py b/unitTests.py index 1569a4d..9ebf02b 100644 --- a/unitTests.py +++ b/unitTests.py @@ -13,7 +13,6 @@ import datetime from pyparsing import ParseException
import pyparsing as pp
-print(pp.__version__)
#~ import HTMLTestRunner
import sys
@@ -3543,6 +3542,16 @@ class ParseActionExceptionTest(ParseTestCase): class ParseActionNestingTest(ParseTestCase):
# tests Issue #22
def runTest(self):
+
+ vals = pp.OneOrMore(pp.pyparsing_common.integer)("int_values")
+ def add_total(tokens):
+ tokens['total'] = sum(tokens)
+ return tokens
+ vals.addParseAction(add_total)
+ results = vals.parseString("244 23 13 2343")
+ print(results.dump())
+ assert results.int_values.asDict() == {}, "noop parse action changed ParseResults structure"
+
name = pp.Word(pp.alphas)('name')
score = pp.Word(pp.nums + '.')('score')
nameScore = pp.Group(name + score)
|