mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 04:48:06 +00:00
Add test case for F401 in __init__ files (#10364)
In preparation for https://github.com/astral-sh/ruff/pull/5845
This commit is contained in:
parent
704fefc7ab
commit
87afe36c87
2 changed files with 18 additions and 1 deletions
|
|
@ -212,7 +212,11 @@ mod tests {
|
|||
fn init() -> Result<()> {
|
||||
let diagnostics = test_path(
|
||||
Path::new("pyflakes/__init__.py"),
|
||||
&LinterSettings::for_rules(vec![Rule::UndefinedName, Rule::UndefinedExport]),
|
||||
&LinterSettings::for_rules(vec![
|
||||
Rule::UndefinedName,
|
||||
Rule::UndefinedExport,
|
||||
Rule::UnusedImport,
|
||||
]),
|
||||
)?;
|
||||
assert_messages!(diagnostics);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,17 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
|
||||
---
|
||||
__init__.py:1:8: F401 [*] `os` imported but unused
|
||||
|
|
||||
1 | import os
|
||||
| ^^ F401
|
||||
2 |
|
||||
3 | print(__path__)
|
||||
|
|
||||
= help: Remove unused import: `os`
|
||||
|
||||
ℹ Safe fix
|
||||
1 |-import os
|
||||
2 1 |
|
||||
3 2 | print(__path__)
|
||||
4 3 |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue