More stringent transform test for assert

This commit is contained in:
rocky
2019-12-14 11:31:13 -05:00
parent 56bf3e3125
commit 41b6e91286

View File

@@ -90,7 +90,11 @@ class TreeTransform(GenericASTTraversal, object):
if stmts in ("c_stmts",) and len(stmts) == 1: if stmts in ("c_stmts",) and len(stmts) == 1:
stmt = stmts[0] stmt = stmts[0]
raise_stmt = stmt[0] raise_stmt = stmt[0]
if raise_stmt == "raise_stmt1" and len(testexpr[0]) == 2: if (
raise_stmt == "raise_stmt1"
and len(testexpr[0]) == 2
and raise_stmt.first_child().pattr == "AssertionError"
):
assert_expr = testexpr[0][0] assert_expr = testexpr[0][0]
assert_expr.kind = "assert_expr" assert_expr.kind = "assert_expr"
jump_cond = testexpr[0][1] jump_cond = testexpr[0][1]