diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/delete.py b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py similarity index 91% rename from crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/delete.py rename to crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py index 5013369e80dc12..63593e52caf54f 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/delete.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py @@ -13,9 +13,11 @@ # Some comment del ( x, + # Slapping one here aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, b, c, d + # Another one ) # Trailing comment # Dangling comment diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py.expect b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py.expect new file mode 100644 index 00000000000000..603ffbc2805290 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py.expect @@ -0,0 +1,29 @@ +x = 1 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1 +b, c, d = (2, 3, 4) + +# Some comment +del x # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d, +) # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + # Slapping one here + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d + # Another one +) # Trailing comment +# Dangling comment diff --git a/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__delete_py.snap b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__delete_py.snap new file mode 100644 index 00000000000000..1989655b4b34bf --- /dev/null +++ b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__delete_py.snap @@ -0,0 +1,127 @@ +--- +source: crates/ruff_python_formatter/src/lib.rs +expression: snapshot +input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/delete.py +--- +## Input + +```py +x = 1 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1 +b, c, d = (2, 3, 4) + +# Some comment +del x # Trailing comment +# Dangling comment + +# Some comment +del x, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, b, c, d # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + # Slapping one here + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d + # Another one +) # Trailing comment +# Dangling comment +``` + +## Black Differences + +```diff +--- Black ++++ Ruff +@@ -7,13 +7,7 @@ + # Dangling comment + + # Some comment +-del ( +- x, +- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, +- b, +- c, +- d, +-) # Trailing comment ++del x, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, b, c, d # Trailing comment + # Dangling comment + + # Some comment +@@ -23,7 +17,7 @@ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, +- d ++ d, + # Another one + ) # Trailing comment + # Dangling comment +``` + +## Ruff Output + +```py +x = 1 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1 +b, c, d = (2, 3, 4) + +# Some comment +del x # Trailing comment +# Dangling comment + +# Some comment +del x, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, b, c, d # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + # Slapping one here + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d, + # Another one +) # Trailing comment +# Dangling comment +``` + +## Black Output + +```py +x = 1 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1 +b, c, d = (2, 3, 4) + +# Some comment +del x # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d, +) # Trailing comment +# Dangling comment + +# Some comment +del ( + x, + # Slapping one here + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + b, + c, + d + # Another one +) # Trailing comment +# Dangling comment +``` + +