Skip to content

Commit

Permalink
switch to snapshot test
Browse files Browse the repository at this point in the history
  • Loading branch information
ntBre committed Nov 26, 2024
1 parent 530ddd2 commit 10b2cac
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 3 deletions.
12 changes: 12 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/pyflakes/F722_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Regression test for #13824.
Don't report an error when the function being annotated has the
`@no_type_check` decorator.
"""

from typing import no_type_check


@no_type_check
def f(arg: "this isn't python") -> "this isn't python either":
pass
12 changes: 12 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/pyflakes/F821_30.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Regression test for #13824.
Don't report an error when the function being annotated has the
`@no_type_check` decorator.
"""

from typing import no_type_check


@no_type_check
def f(arg: "A") -> "R":
pass
4 changes: 3 additions & 1 deletion crates/ruff_linter/src/rules/pyflakes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ mod tests {
#[test_case(Rule::YieldOutsideFunction, Path::new("F704.py"))]
#[test_case(Rule::ReturnOutsideFunction, Path::new("F706.py"))]
#[test_case(Rule::DefaultExceptNotLast, Path::new("F707.py"))]
#[test_case(Rule::ForwardAnnotationSyntaxError, Path::new("F722.py"))]
#[test_case(Rule::ForwardAnnotationSyntaxError, Path::new("F722_0.py"))]
#[test_case(Rule::ForwardAnnotationSyntaxError, Path::new("F722_1.py"))]
#[test_case(Rule::RedefinedWhileUnused, Path::new("F811_0.py"))]
#[test_case(Rule::RedefinedWhileUnused, Path::new("F811_1.py"))]
#[test_case(Rule::RedefinedWhileUnused, Path::new("F811_2.py"))]
Expand Down Expand Up @@ -159,6 +160,7 @@ mod tests {
#[test_case(Rule::UndefinedName, Path::new("F821_26.pyi"))]
#[test_case(Rule::UndefinedName, Path::new("F821_27.py"))]
#[test_case(Rule::UndefinedName, Path::new("F821_28.py"))]
#[test_case(Rule::UndefinedName, Path::new("F821_30.py"))]
#[test_case(Rule::UndefinedExport, Path::new("F822_0.py"))]
#[test_case(Rule::UndefinedExport, Path::new("F822_0.pyi"))]
#[test_case(Rule::UndefinedExport, Path::new("F822_1.py"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
snapshot_kind: text
---
F722.py:9:12: F722 Syntax error in forward annotation: `///`
F722_0.py:9:12: F722 Syntax error in forward annotation: `///`
|
9 | def g() -> "///":
| ^^^^^ F722
10 | pass
|

F722.py:13:4: F722 Syntax error in forward annotation: `List[int]☃`
F722_0.py:13:4: F722 Syntax error in forward annotation: `List[int]☃`
|
13 | X: """List[int]"""'' = []
| ^^^^^^^^^^^^^^^^^^ F722
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
snapshot_kind: text
---

0 comments on commit 10b2cac

Please sign in to comment.