summaryrefslogtreecommitdiff
path: root/src/unitTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/unitTests.py')
-rw-r--r--src/unitTests.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/unitTests.py b/src/unitTests.py
index 87b4beb..1f7964e 100644
--- a/src/unitTests.py
+++ b/src/unitTests.py
@@ -2529,6 +2529,58 @@ class TrimArityExceptionMaskingTest(ParseTestCase):
exc_msg = str(e)
assert exc_msg != invalid_message, "failed to catch TypeError thrown in _trim_arity"
+class TrimArityExceptionMaskingTest2(ParseTestCase):
+ def runTest(self):
+
+
+ # construct deep call tree
+ def A():
+ import traceback
+
+ traceback.print_stack(limit=2)
+
+ from pyparsing import Word
+
+ invalid_message = [
+ "<lambda>() takes exactly 1 argument (0 given)",
+ "<lambda>() missing 1 required positional argument: 't'"
+ ][PY_3]
+ try:
+ Word('a').setParseAction(lambda t: t[0]+1).parseString('aaa')
+ except Exception as e:
+ exc_msg = str(e)
+ assert exc_msg != invalid_message, "failed to catch TypeError thrown in _trim_arity"
+
+
+ def B():
+ A()
+
+ def C():
+ B()
+
+ def D():
+ C()
+
+ def E():
+ D()
+
+ def F():
+ E()
+
+ def G():
+ F()
+
+ def H():
+ G()
+
+ def J():
+ H()
+
+ def K():
+ J()
+
+ K()
+
class OneOrMoreStopTest(ParseTestCase):
def runTest(self):
from pyparsing import (Word, OneOrMore, alphas, Keyword, CaselessKeyword,