Skip to content

Commit

Permalink
[red-knot] Use unambiguous invalid-syntax-construct for suppression c…
Browse files Browse the repository at this point in the history
…omment test (#15933)

## Summary

I experimented with [not trimming trailing newlines in code
snippets](#15926 (comment)),
but since came to the conclusion that the current behavior is better
because otherwise, there is no way to write snippets without a trailing
newline at all. And when you copy the code from a Markdown snippet in
GitHub, you also don't get a trailing newline.

I was surprised to see some test failures when I played with this
though, and decided to make this test independent from this
implementation detail.
  • Loading branch information
sharkdp authored Feb 4, 2025
1 parent f23802e commit 24c1cf7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def test(a: f"f-string type annotation", b: b"byte-string-type-annotation"): ...
```py
# error: [invalid-syntax]
# error: [unused-ignore-comment]
def test( # knot: ignore
def test($): # knot: ignore
pass
```

<!-- blacken-docs:on -->
Expand Down

0 comments on commit 24c1cf7

Please sign in to comment.