Skip to content

Commit bfcd48e

Browse files
committed
test: update snapshots with improper end-of-line placement
This looks like a bug fix that occurs when the annotation is a zero-width span immediately following a line terminator. Previously, the caret seems to be rendered on the next line, but it should be rendered at the end of the line the span corresponds to. I admit that this one is kinda weird. I would somewhat expect that our spans here are actually incorrect, and that to obtain this sort of rendering, we should identify a span just immediately _before_ the line terminator and not after it. But I don't want to dive into that rabbit hole for now (and given how `annotate-snippets` now renders these spans, perhaps there is more to it than I see), and this does seem like a clear improvement given the spans we feed to `annotate-snippets`.
1 parent a97e262 commit bfcd48e

8 files changed

+29
-35
lines changed

crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
source: crates/ruff_linter/src/rules/isort/mod.rs
3-
snapshot_kind: text
43
---
54
line_ending_crlf.py:1:1: I001 [*] Import block is un-sorted or un-formatted
65
|
7-
1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five
8-
2 | |
9-
| |_^ I001
6+
1 | from long_module_name import member_one, member_two, member_three, member_four, member_five
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
8+
2 |
109
|
1110
= help: Organize imports
1211

crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
source: crates/ruff_linter/src/rules/isort/mod.rs
3-
snapshot_kind: text
43
---
54
line_ending_lf.py:1:1: I001 [*] Import block is un-sorted or un-formatted
65
|
7-
1 | / from long_module_name import member_one, member_two, member_three, member_four, member_five
8-
2 | |
9-
| |_^ I001
6+
1 | from long_module_name import member_one, member_two, member_three, member_four, member_five
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
8+
2 |
109
|
1110
= help: Organize imports
1211

crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
source: crates/ruff_linter/src/rules/isort/mod.rs
3-
snapshot_kind: text
43
---
54
no_wrap_star.py:1:1: I001 [*] Import block is un-sorted or un-formatted
65
|
7-
1 | / from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore
6+
1 | from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I001
88
|
99
= help: Organize imports
1010

crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
source: crates/ruff_linter/src/rules/isort/mod.rs
3-
snapshot_kind: text
43
---
54
split.py:15:1: I001 [*] Import block is un-sorted or un-formatted
65
|
76
14 | if True:
87
15 | / import C
98
16 | | import A
10-
17 | |
11-
| |_^ I001
9+
| |_____________^ I001
10+
17 |
1211
18 | # isort: split
1312
|
1413
= help: Organize imports
@@ -27,12 +26,12 @@ split.py:15:1: I001 [*] Import block is un-sorted or un-formatted
2726
split.py:20:1: I001 [*] Import block is un-sorted or un-formatted
2827
|
2928
18 | # isort: split
30-
19 |
29+
19 |
3130
20 | / import D
3231
21 | | import B
33-
22 | |
34-
| |_^ I001
35-
23 |
32+
| |_____________^ I001
33+
22 |
34+
23 |
3635
24 | import e
3736
|
3837
= help: Organize imports
@@ -51,9 +50,10 @@ split.py:20:1: I001 [*] Import block is un-sorted or un-formatted
5150
split.py:30:1: I001 [*] Import block is un-sorted or un-formatted
5251
|
5352
28 | # isort: split
54-
29 |
53+
29 |
5554
30 | / import d
5655
31 | | import c
56+
| |_________^ I001
5757
|
5858
= help: Organize imports
5959

crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_misspelled_elif.py.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: crates/ruff_python_parser/tests/fixtures.rs
33
input_file: crates/ruff_python_parser/resources/inline/err/if_stmt_misspelled_elif.py
4-
snapshot_kind: text
54
---
65
## AST
76

@@ -90,8 +89,8 @@ Module(
9089
|
9190
3 | elf:
9291
4 | pass
92+
| ^ Syntax Error: Expected a statement
9393
5 | else:
94-
| Syntax Error: Expected a statement
9594
6 | pass
9695
|
9796

@@ -125,4 +124,5 @@ Module(
125124
|
126125
5 | else:
127126
6 | pass
127+
| ^ Syntax Error: Expected a statement
128128
|

crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_expected_case_block.py.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: crates/ruff_python_parser/tests/fixtures.rs
33
input_file: crates/ruff_python_parser/resources/inline/err/match_stmt_expected_case_block.py
4-
snapshot_kind: text
54
---
65
## AST
76

@@ -113,8 +112,8 @@ Module(
113112
|
114113
1 | match x:
115114
2 | x = 1
115+
| ^ Syntax Error: Expected a statement
116116
3 | match x:
117-
| Syntax Error: Expected a statement
118117
4 | match y:
119118
5 | case _: ...
120119
|
@@ -132,4 +131,5 @@ Module(
132131
|
133132
4 | match y:
134133
5 | case _: ...
134+
| ^ Syntax Error: Expected a statement
135135
|

crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: crates/ruff_python_parser/tests/fixtures.rs
33
input_file: crates/ruff_python_parser/resources/invalid/re_lex_logical_token_windows_eol.py
4-
snapshot_kind: text
54
---
65
## AST
76

@@ -100,9 +99,8 @@ Module(
10099
## Errors
101100

102101
|
103-
1 | if call(foo, [a, b
104-
| ___________________^
105-
2 | | def bar():
106-
| |_^ Syntax Error: Expected ']', found NonLogicalNewline
107-
3 | pass
102+
1 | if call(foo, [a, b
103+
| ^ Syntax Error: Expected ']', found NonLogicalNewline
104+
2 | def bar():
105+
3 | pass
108106
|

crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: crates/ruff_python_parser/tests/fixtures.rs
33
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/line_continuation_windows_eol.py
4-
snapshot_kind: text
54
---
65
## AST
76

@@ -82,10 +81,9 @@ Module(
8281
## Errors
8382

8483
|
85-
1 | call(a, b, # comment \
86-
| _______________________^
87-
2 | |
88-
| |_^ Syntax Error: Expected ')', found newline
89-
3 | def bar():
90-
4 | pass
84+
1 | call(a, b, # comment \
85+
| ^ Syntax Error: Expected ')', found newline
86+
2 |
87+
3 | def bar():
88+
4 | pass
9189
|

0 commit comments

Comments
 (0)