refactor: tests use new marco
This commit is contained in:
committed by
Charlie Marsh
parent
413acdf83c
commit
e9c1089ddc
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::CommentedOutCode, Path::new("ERA001.py"); "ERA001")]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::SysVersionSlice3Referenced, Path::new("YTT101.py"); "YTT101")]
|
||||
#[test_case(Rule::SysVersion2Referenced, Path::new("YTT102.py"); "YTT102")]
|
||||
@@ -30,7 +30,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ mod tests {
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -34,7 +35,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::DynamicallyTypedExpression])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -38,7 +39,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::HardcodedTempFile)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("S108_extend", diagnostics);
|
||||
assert_yaml_snapshot!("S108_extend", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::BlindExcept, Path::new("BLE.py"); "BLE001")]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
@@ -21,7 +21,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::BooleanPositionalArgInFunctionDefinition, Path::new("FBT.py"); "FBT001")]
|
||||
#[test_case(Rule::BooleanDefaultValueInFunctionDefinition, Path::new("FBT.py"); "FBT002")]
|
||||
@@ -23,7 +23,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -49,7 +50,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::FunctionCallArgumentDefault])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -25,7 +26,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Path::new("COM81.py"); "COM81")]
|
||||
fn rules(path: &Path) -> Result<()> {
|
||||
@@ -25,7 +25,7 @@ mod tests {
|
||||
Rule::TrailingCommaProhibited,
|
||||
]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::UnnecessaryGeneratorList, Path::new("C400.py"); "C400")]
|
||||
#[test_case(Rule::UnnecessaryGeneratorSet, Path::new("C401.py"); "C401")]
|
||||
@@ -38,7 +38,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::CallDatetimeWithoutTzinfo, Path::new("DTZ001.py"); "DTZ001")]
|
||||
#[test_case(Rule::CallDatetimeToday, Path::new("DTZ002.py"); "DTZ002")]
|
||||
@@ -29,7 +29,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::Debugger, Path::new("T100.py"); "T100")]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test]
|
||||
fn defaults() -> Result<()> {
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
Rule::DotFormatInException,
|
||||
]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("defaults", diagnostics);
|
||||
assert_yaml_snapshot!("defaults", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("custom", diagnostics);
|
||||
assert_yaml_snapshot!("custom", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Path::new("EXE001_1.py"); "EXE001_1")]
|
||||
#[test_case(Path::new("EXE001_2.py"); "EXE001_2")]
|
||||
@@ -40,7 +40,7 @@ mod tests {
|
||||
Rule::ShebangPython,
|
||||
]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::SingleLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC001")]
|
||||
#[test_case(Rule::MultiLineImplicitStringConcatenation, Path::new("ISC.py"); "ISC002")]
|
||||
@@ -24,7 +24,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -19,7 +20,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/flake8_import_conventions/defaults.py"),
|
||||
&Settings::for_rule(Rule::ImportAliasIsNotConventional),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("defaults", diagnostics);
|
||||
assert_yaml_snapshot!("defaults", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::ImportAliasIsNotConventional)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("custom", diagnostics);
|
||||
assert_yaml_snapshot!("custom", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::ImportAliasIsNotConventional)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("remove_default", diagnostics);
|
||||
assert_yaml_snapshot!("remove_default", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::ImportAliasIsNotConventional)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("override_default", diagnostics);
|
||||
assert_yaml_snapshot!("override_default", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::ImportAliasIsNotConventional)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!("from_imports", diagnostics);
|
||||
assert_yaml_snapshot!("from_imports", diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -32,7 +33,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::ImplicitNamespacePackage)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::DupeClassFieldDefinitions, Path::new("PIE794.py"); "PIE794")]
|
||||
#[test_case(Rule::NoUnnecessaryDictKwargs, Path::new("PIE804.py"); "PIE804")]
|
||||
@@ -26,7 +26,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::PrintFound, Path::new("T201.py"); "T201")]
|
||||
#[test_case(Rule::PPrintFound, Path::new("T203.py"); "T203")]
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ mod tests {
|
||||
use super::types;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::IncorrectFixtureParenthesesStyle, Path::new("PT001.py"), Settings::default(), "PT001_default"; "PT001_0")]
|
||||
#[test_case(
|
||||
@@ -256,7 +256,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(name, diagnostics);
|
||||
assert_yaml_snapshot!(name, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ mod tests {
|
||||
use test_case::test_case;
|
||||
|
||||
use super::settings::Quote;
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -40,7 +41,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -140,7 +141,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -30,7 +31,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::DuplicateIsinstanceCall, Path::new("SIM101.py"); "SIM101")]
|
||||
#[test_case(Rule::NestedIfStatements, Path::new("SIM102.py"); "SIM102")]
|
||||
@@ -45,7 +45,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ mod tests {
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use super::ApiBan;
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -137,7 +138,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::BannedApi])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
|
||||
use super::Strictness;
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -77,7 +78,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::RelativeImports])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::RelativeImports])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::TypingOnlyFirstPartyImport, Path::new("TCH001.py"); "TCH001")]
|
||||
#[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("TCH002.py"); "TCH002")]
|
||||
@@ -34,7 +34,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::UnusedFunctionArgument, Path::new("ARG.py"); "ARG001")]
|
||||
#[test_case(Rule::UnusedMethodArgument, Path::new("ARG.py"); "ARG002")]
|
||||
@@ -28,7 +28,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,6 +682,7 @@ mod tests {
|
||||
|
||||
use super::categorize::ImportType;
|
||||
use super::settings::RelatveImportsOrder;
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -738,7 +739,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -758,7 +759,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -779,7 +780,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -799,7 +800,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -822,7 +823,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -843,7 +844,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -873,7 +874,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -905,7 +906,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -935,7 +936,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -956,7 +957,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -980,7 +981,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::MissingRequiredImport)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1005,7 +1006,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::MissingRequiredImport)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1029,7 +1030,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::MissingRequiredImport)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1051,7 +1052,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::MissingRequiredImport)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1071,7 +1072,7 @@ mod tests {
|
||||
..Settings::for_rule(Rule::UnsortedImports)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1098,7 +1099,7 @@ mod tests {
|
||||
},
|
||||
)?;
|
||||
diagnostics.sort_by_key(|diagnostic| diagnostic.location);
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::Settings;
|
||||
@@ -25,7 +26,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::FunctionIsTooComplex])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::InvalidClassName, Path::new("N801.py"); "N801")]
|
||||
#[test_case(Rule::InvalidFunctionName, Path::new("N802.py"); "N802")]
|
||||
@@ -37,7 +37,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ mod tests {
|
||||
use super::settings::Settings;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::MultipleImportsOnOneLine, Path::new("E40.py"))]
|
||||
#[test_case(Rule::ModuleImportNotAtTopOfFile, Path::new("E40.py"))]
|
||||
@@ -47,7 +47,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ mod tests {
|
||||
Rule::IsLiteral,
|
||||
]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::LineTooLong)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::DocLineTooLong)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ mod tests {
|
||||
use super::settings::{Convention, Settings};
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::PublicModule, Path::new("D.py"); "D100")]
|
||||
#[test_case(Rule::PublicClass, Path::new("D.py"); "D101")]
|
||||
@@ -74,7 +74,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::DocumentAllArguments)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::DocumentAllArguments)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::DocumentAllArguments)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ mod tests {
|
||||
use crate::registry::{Rule, RuleCodePrefix};
|
||||
use crate::settings::flags;
|
||||
use crate::source_code::{Indexer, Locator, Stylist};
|
||||
use crate::{directives, rustpython_helpers, settings};
|
||||
use crate::{assert_yaml_snapshot, directives, rustpython_helpers, settings};
|
||||
|
||||
#[test_case(Rule::UnusedImport, Path::new("F401_0.py"); "F401_0")]
|
||||
#[test_case(Rule::UnusedImport, Path::new("F401_1.py"); "F401_1")]
|
||||
@@ -112,7 +112,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::UnusedVariable)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/pyflakes/__init__.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UndefinedName, Rule::UndefinedExport]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/pyflakes/builtins.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UndefinedName]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ mod tests {
|
||||
..settings::Settings::for_rules(vec![Rule::UndefinedName])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/pyflakes/typing_modules.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UndefinedName]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ mod tests {
|
||||
..settings::Settings::for_rules(vec![Rule::UndefinedName])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/pyflakes/future_annotations.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UnusedImport, Rule::UndefinedName]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/pyflakes/multi_statement_lines.py"),
|
||||
&settings::Settings::for_rule(Rule::UnusedImport),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::NoEval, Path::new("PGH001_0.py"); "PGH001_0")]
|
||||
#[test_case(Rule::NoEval, Path::new("PGH001_1.py"); "PGH001_1")]
|
||||
@@ -26,7 +26,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use test_case::test_case;
|
||||
|
||||
use crate::assert_yaml_snapshot;
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::rules::pylint;
|
||||
@@ -41,7 +42,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&Settings::for_rules(vec![rule_code]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ mod tests {
|
||||
..Settings::for_rules(vec![Rule::MagicValueComparison])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::settings::types::PythonVersion;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::UselessMetaclassType, Path::new("UP001.py"); "UP001")]
|
||||
#[test_case(Rule::TypeOfPrimitive, Path::new("UP003.py"); "UP003")]
|
||||
@@ -66,7 +66,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::UsePEP585Annotation)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::UsePEP585Annotation)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::UsePEP604Annotation)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::UsePEP604Annotation)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ mod tests {
|
||||
..settings::Settings::for_rule(Rule::DatetimeTimezoneUTC)
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::KeywordArgumentBeforeStarArgument, Path::new("RUF004.py"); "RUF004")]
|
||||
#[test_case(Rule::UnpackInsteadOfConcatenatingToCollectionLiteral, Path::new("RUF005.py"); "RUF005")]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
@@ -23,7 +24,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ mod tests {
|
||||
])
|
||||
},
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ mod tests {
|
||||
Rule::UnusedVariable,
|
||||
]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/ruff/RUF100_1.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UnusedNOQA, Rule::UnusedImport]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/ruff/flake8_noqa.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UnusedImport, Rule::UnusedVariable]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/ruff/ruff_noqa.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UnusedImport, Rule::UnusedVariable]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ mod tests {
|
||||
Path::new("./resources/test/fixtures/ruff/redirects.py"),
|
||||
&settings::Settings::for_rules(vec![Rule::UsePEP604Annotation]),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(diagnostics);
|
||||
assert_yaml_snapshot!(diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
|
||||
use crate::linter::test_path;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings;
|
||||
use crate::{assert_yaml_snapshot, settings};
|
||||
|
||||
#[test_case(Rule::PreferTypeError, Path::new("TRY004.py"); "TRY004")]
|
||||
#[test_case(Rule::ReraiseNoCause, Path::new("TRY200.py"); "TRY200")]
|
||||
@@ -26,7 +26,7 @@ mod tests {
|
||||
.as_path(),
|
||||
&settings::Settings::for_rule(rule_code),
|
||||
)?;
|
||||
insta::assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
assert_yaml_snapshot!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user