Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ast.NodeTransformer is not tested #100518

Closed
sobolevn opened this issue Dec 24, 2022 · 1 comment
Closed

ast.NodeTransformer is not tested #100518

sobolevn opened this issue Dec 24, 2022 · 1 comment
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Dec 24, 2022

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

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Dec 24, 2022
@sobolevn sobolevn self-assigned this Dec 24, 2022
sobolevn added a commit to sobolevn/cpython that referenced this issue Dec 25, 2022
@hauntsaninja
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants