Implement F707 (DefaultExceptNotLast) (#101)

This commit is contained in:
Harutaka Kawamura 2022-09-05 00:55:06 +09:00 committed by GitHub
parent 8f6ab8b37a
commit b86414dc7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 119 additions and 0 deletions

View file

@ -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(