summaryrefslogtreecommitdiff
path: root/unitTests.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2018-10-07 13:29:00 -0500
committerptmcg <ptmcg@austin.rr.com>2018-10-07 13:29:00 -0500
commitdc074e25459062578e9104dda3e86b662715f966 (patch)
tree90e7da431282f14d994d809a4d6b4db744230f5e /unitTests.py
parent6c98d20bd25fb34af629847c94f3283c28d1a4ab (diff)
downloadpyparsing-git-dc074e25459062578e9104dda3e86b662715f966.tar.gz
Better description of bug and fix for Issue #22
Diffstat (limited to 'unitTests.py')
-rw-r--r--unitTests.py11
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)