Add tests for python version compatibility (#14430)

This commit is contained in:
Micha Reiser 2024-11-18 13:26:55 +01:00 committed by GitHub
parent d81b6cd334
commit 1f07880d5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 2 deletions

View file

@ -3408,7 +3408,9 @@ pub struct AnalyzeOptions {
mod tests {
use crate::options::Flake8SelfOptions;
use ruff_linter::rules::flake8_self;
use ruff_linter::settings::types::PythonVersion as LinterPythonVersion;
use ruff_python_ast::name::Name;
use ruff_python_formatter::PythonVersion as FormatterPythonVersion;
#[test]
fn flake8_self_options() {
@ -3456,4 +3458,28 @@ mod tests {
vec![Name::new_static("_foo"), Name::new_static("_bar")]
);
}
#[test]
fn formatter_and_linter_target_version_have_same_default() {
assert_eq!(
FormatterPythonVersion::default().as_tuple(),
LinterPythonVersion::default().as_tuple()
);
}
#[test]
fn formatter_and_linter_target_version_have_same_latest() {
assert_eq!(
FormatterPythonVersion::latest().as_tuple(),
LinterPythonVersion::latest().as_tuple()
);
}
#[test]
fn formatter_and_linter_target_version_have_same_minimal_supported() {
assert_eq!(
FormatterPythonVersion::minimal_supported().as_tuple(),
LinterPythonVersion::minimal_supported().as_tuple()
);
}
}