AnnAssign allows invalid whitespace around equals
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that `AnnAssign` allows for whitespace which includes newlines before or after the equals without a line continuation character. Is this expected? It seems when you construct other nodes, they throw a `CSTValidationError` if the node would represent invalid Python code.
Here is an example where there is a newline before the equals sign:
```Python3
from libcst import (AnnAssign, Annotation, AssignEqual, Name,
ParenthesizedWhitespace, TrailingWhitespace)
AnnAssign(
target=Name(
value='foo',
),
annotation=Annotation(
annotation=Name(
value='Foo'
),
),
value=Name(
value='bar'
),
equal=AssignEqual(
whitespace_before=ParenthesizedWhitespace(
first_line=TrailingWhitespace()
),
)
)
```
And this would represent the following:
```Python3
foo:Foo
=bar
```
Contributor guide
Assessment
This issue has not been assessed yet.