mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Implement F707 (DefaultExceptNotLast) (#101)
This commit is contained in:
parent
8f6ab8b37a
commit
b86414dc7a
9 changed files with 119 additions and 0 deletions
|
@ -320,6 +320,47 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn f707() -> Result<()> {
|
||||
let actual = check_path(
|
||||
Path::new("./resources/test/fixtures/F707.py"),
|
||||
&settings::Settings {
|
||||
line_length: 88,
|
||||
exclude: vec![],
|
||||
select: BTreeSet::from([CheckCode::F707]),
|
||||
},
|
||||
&cache::Mode::None,
|
||||
)?;
|
||||
let expected = vec![
|
||||
Message {
|
||||
kind: CheckKind::DefaultExceptNotLast,
|
||||
location: Location::new(3, 1),
|
||||
filename: "./resources/test/fixtures/F707.py".to_string(),
|
||||
},
|
||||
Message {
|
||||
kind: CheckKind::DefaultExceptNotLast,
|
||||
location: Location::new(10, 1),
|
||||
filename: "./resources/test/fixtures/F707.py".to_string(),
|
||||
},
|
||||
Message {
|
||||
kind: CheckKind::DefaultExceptNotLast,
|
||||
location: Location::new(19, 1),
|
||||
filename: "./resources/test/fixtures/F707.py".to_string(),
|
||||
},
|
||||
Message {
|
||||
kind: CheckKind::DefaultExceptNotLast,
|
||||
location: Location::new(28, 1),
|
||||
filename: "./resources/test/fixtures/F707.py".to_string(),
|
||||
},
|
||||
];
|
||||
assert_eq!(actual.len(), expected.len());
|
||||
for i in 0..actual.len() {
|
||||
assert_eq!(actual[i], expected[i]);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn f821() -> Result<()> {
|
||||
let actual = check_path(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue