Skip to content

Commit

Permalink
Add some color to children-vs-codegen error (#583)
Browse files Browse the repository at this point in the history
It took me some time to track down the root cause of `children`
not matching codegen, having the error message directly hint that
visit and codegen are probably mimatched (my visit was running
out-of-order) will likely help newbies get going faster.
  • Loading branch information
stroxler authored Jan 5, 2022
1 parent 601db54 commit 3578f2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libcst/_nodes/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def __assert_children_match_codegen(self, node: cst.CSTNode) -> None:
codegen_children,
msg=(
"The list of children we got from `node.children` differs from the "
+ "children that were visited by `node._codegen`."
+ "children that were visited by `node._codegen`. This is probably "
+ "due to a mismatch between _visit_and_replace_children and "
+ "_codegen_impl."
),
)

Expand Down

0 comments on commit 3578f2f

Please sign in to comment.