Skip to content

ast.NodeTransformer is not tested #100518

Closed
Closed
@sobolevn

Description

@sobolevn

There are no tests for ast.NodeTransformer:

» ag NodeTransformer
Misc/NEWS.d/3.9.0a3.rst
817:In the :mod:`ast` module documentation, fix a misleading ``NodeTransformer``

Lib/inspect.py
2230:    class RewriteSymbolics(ast.NodeTransformer):

Lib/ast.py
411:    traversing.  For this a special visitor exists (`NodeTransformer`) that
453:class NodeTransformer(NodeVisitor):
458:    The `NodeTransformer` will walk the AST and use the return value of the
467:       class RewriteName(NodeTransformer):

Doc/library/ast.rst
2122:   (:class:`NodeTransformer`) that allows modifications.
2132:.. class:: NodeTransformer()
2137:   The :class:`NodeTransformer` will walk the AST and use the return value of
2146:      class RewriteName(NodeTransformer):
2163:   If :class:`NodeTransformer` introduces new nodes (that weren't part of

Doc/whatsnew/2.6.rst
2740::class:`NodeTransformer` classes for traversing and modifying an AST,

I think we should add at least some high-level tests that will check the desired behaviour.
I will send a PR today.

Linked PRs

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions