mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:47:41 +00:00
Add tests demonstrating f-strings with debug expressions in replacements that contain escaped characters (#14929)
This commit is contained in:
parent
2eac00c60f
commit
82faa9bb62
4 changed files with 96 additions and 4 deletions
|
@ -177,12 +177,9 @@ fn format() {
|
|||
let test_file = |input_path: &Path| {
|
||||
let content = fs::read_to_string(input_path).unwrap();
|
||||
|
||||
let options = PyFormatOptions::from_extension(input_path);
|
||||
let formatted_code = format_file(&content, &options, input_path);
|
||||
|
||||
let mut snapshot = format!("## Input\n{}", CodeFrame::new("python", &content));
|
||||
|
||||
let options_path = input_path.with_extension("options.json");
|
||||
|
||||
if let Ok(options_file) = fs::File::open(options_path) {
|
||||
let reader = BufReader::new(options_file);
|
||||
let options: Vec<PyFormatOptions> =
|
||||
|
@ -228,6 +225,9 @@ fn format() {
|
|||
}
|
||||
} else {
|
||||
// We want to capture the differences in the preview style in our fixtures
|
||||
let options = PyFormatOptions::from_extension(input_path);
|
||||
let formatted_code = format_file(&content, &options, input_path);
|
||||
|
||||
let options_preview = options.with_preview(PreviewMode::Enabled);
|
||||
let formatted_preview = format_file(&content, &options_preview, input_path);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue