mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
[flake8-datetimez
] Stabilize datetime-min-max
(DTZ901
) (#16635)
Summary -- Stabilizes DTZ901, renames the rule function to match the rule name, removes the `preview_rules` test, and handles some nits in the docs (mention `min` first to match the rule name too). Test Plan -- 1 closed issue on 2024-11-12, 4 days after the rule was added. No issues since
This commit is contained in:
parent
c605ce6fe2
commit
ba37c7cdba
4 changed files with 8 additions and 22 deletions
|
@ -9,7 +9,6 @@ mod tests {
|
|||
use test_case::test_case;
|
||||
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::types::PreviewMode;
|
||||
use crate::test::test_path;
|
||||
use crate::{assert_messages, settings};
|
||||
|
||||
|
@ -22,6 +21,7 @@ mod tests {
|
|||
#[test_case(Rule::CallDatetimeStrptimeWithoutZone, Path::new("DTZ007.py"))]
|
||||
#[test_case(Rule::CallDateToday, Path::new("DTZ011.py"))]
|
||||
#[test_case(Rule::CallDateFromtimestamp, Path::new("DTZ012.py"))]
|
||||
#[test_case(Rule::DatetimeMinMax, Path::new("DTZ901.py"))]
|
||||
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
||||
let diagnostics = test_path(
|
||||
|
@ -31,18 +31,4 @@ mod tests {
|
|||
assert_messages!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case(Rule::DatetimeMinMax, Path::new("DTZ901.py"))]
|
||||
fn preview_rules(rule_code: Rule, path: &Path) -> Result<()> {
|
||||
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
||||
let diagnostics = test_path(
|
||||
Path::new("flake8_datetimez").join(path).as_path(),
|
||||
&settings::LinterSettings {
|
||||
preview: PreviewMode::Enabled,
|
||||
..settings::LinterSettings::for_rule(rule_code)
|
||||
},
|
||||
)?;
|
||||
assert_messages!(snapshot, diagnostics);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue