summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2020-02-04 22:20:40 -0600
committerptmcg <ptmcg@austin.rr.com>2020-02-04 22:20:40 -0600
commitd9a1bc8b9137776b469a8bbc5876764cc7ea9fcd (patch)
tree5a7dd1d7da3ba446bd6b57ebff9edb921e96b2ef /tests
parent8d9ab59a2b2767ad56c9b852c325075113718c0a (diff)
downloadpyparsing-git-d9a1bc8b9137776b469a8bbc5876764cc7ea9fcd.tar.gz
Add unit test sequences for small and unbounded packrat caches
Diffstat (limited to 'tests')
-rw-r--r--tests/test_unit.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_unit.py b/tests/test_unit.py
index 3028db6..49cabc3 100644
--- a/tests/test_unit.py
+++ b/tests/test_unit.py
@@ -6643,6 +6643,7 @@ class Test3_EnablePackratParsing(TestCase):
ParserElement.enablePackrat()
# SAVE A NEW SUITE CONTEXT
+ Test2_WithoutPackrat.save_suite_context = Test2_WithoutPackrat.suite_context
Test2_WithoutPackrat.suite_context = ppt.reset_pyparsing_context()
Test2_WithoutPackrat.suite_context.save()
@@ -6650,5 +6651,37 @@ class Test3_EnablePackratParsing(TestCase):
Test4_WithPackrat = type("Test4_WithPackrat", (Test2_WithoutPackrat,), {})
+class Test5_EnableBoundedPackratParsing(TestCase):
+ def runTest(self):
+ Test2_WithoutPackrat.suite_context = Test2_WithoutPackrat.save_suite_context
+ Test2_WithoutPackrat.suite_context.restore()
+
+ ParserElement.enablePackrat(16)
+
+ # SAVE A NEW SUITE CONTEXT
+ Test2_WithoutPackrat.suite_context = ppt.reset_pyparsing_context()
+ Test2_WithoutPackrat.suite_context.save()
+
+
+Test6_WithBoundedPackrat = type("Test6_WithBoundedPackrat", (Test2_WithoutPackrat,), {})
+
+
+class Test7_EnableUnboundedPackratParsing(TestCase):
+ def runTest(self):
+ Test2_WithoutPackrat.suite_context = Test2_WithoutPackrat.save_suite_context
+ Test2_WithoutPackrat.suite_context.restore()
+
+ ParserElement.enablePackrat(None)
+
+ # SAVE A NEW SUITE CONTEXT
+ Test2_WithoutPackrat.suite_context = ppt.reset_pyparsing_context()
+ Test2_WithoutPackrat.suite_context.save()
+
+
+Test8_WithUnboundedPackrat = type(
+ "Test8_WithUnboundedPackrat", (Test2_WithoutPackrat,), {}
+)
+
+
Test2_WithoutPackrat.suite_context = ppt.reset_pyparsing_context()
Test2_WithoutPackrat.suite_context.save()