summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2022-11-11 02:26:57 -0600
committerptmcg <ptmcg@austin.rr.com>2022-11-11 02:26:57 -0600
commit116dc35fe50be5dd5419db23f057daf8f08b405a (patch)
tree3d75f6263413ace284f12dc2f3c15e72d084eb78
parent6db02f02d203859311e6de3f16e14bd1c2615b4c (diff)
downloadpyparsing-git-116dc35fe50be5dd5419db23f057daf8f08b405a.tar.gz
Debugging railroad diagram tests
-rw-r--r--tests/test_diagram.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_diagram.py b/tests/test_diagram.py
index 77672b3..52bb0c7 100644
--- a/tests/test_diagram.py
+++ b/tests/test_diagram.py
@@ -49,25 +49,29 @@ class TestRailroadDiagrams(unittest.TestCase):
railroad = to_railroad(expr, show_results_names=show_results_names)
# temp.write(railroad_to_html(railroad))
- if self.railroad_debug():
+ if self.railroad_debug() or True:
print(f"{label}: {temp.name}")
return railroad
def test_example_rr_diags(self):
subtests = [
- (boolExpr, "boolExpr", 5),
(jsonObject, "jsonObject", 8),
+ (boolExpr, "boolExpr", 5),
(simpleSQL, "simpleSQL", 20),
(calendars, "calendars", 13),
]
for example_expr, label, expected_rr_len in subtests:
with self.subTest(f"{label}: test rr diag without results names"):
railroad = self.generate_railroad(example_expr, example_expr)
+ if len(railroad) != expected_rr_len:
+ print(railroad_to_html(railroad))
assert len(railroad) == expected_rr_len, f"expected {expected_rr_len}, got {len(railroad)}"
with self.subTest(f"{label}: test rr diag with results names"):
railroad = self.generate_railroad(example_expr, example_expr, show_results_names=True)
+ if len(railroad) != expected_rr_len:
+ print(railroad_to_html(railroad))
assert len(railroad) == expected_rr_len, f"expected {expected_rr_len}, got {len(railroad)}"
def test_nested_forward_with_inner_and_outer_names(self):