From e03aa974b1bf2a162a3a4d7a66b5648f2f3a6f34 Mon Sep 17 00:00:00 2001 From: Chris Pryer Date: Sat, 17 Jun 2023 22:06:16 -0400 Subject: [PATCH] Use black fixture --- .../fixtures/black/simple_cases/assert.py | 6 ++ .../black/simple_cases/assert.py.expect | 6 ++ ...rmatter__tests__black_test__assert_py.snap | 58 +++++++++++++++++++ ...ests__ruff_test__statement__assert_py.snap | 27 +++++++++ 4 files changed, 97 insertions(+) create mode 100644 crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py create mode 100644 crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py.expect create mode 100644 crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__assert_py.snap create mode 100644 crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__ruff_test__statement__assert_py.snap diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py new file mode 100644 index 00000000000000..00422925114872 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py @@ -0,0 +1,6 @@ +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment diff --git a/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py.expect b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py.expect new file mode 100644 index 00000000000000..00422925114872 --- /dev/null +++ b/crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py.expect @@ -0,0 +1,6 @@ +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment diff --git a/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__assert_py.snap b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__assert_py.snap new file mode 100644 index 00000000000000..bb19ef73c80151 --- /dev/null +++ b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__black_test__assert_py.snap @@ -0,0 +1,58 @@ +--- +source: crates/ruff_python_formatter/src/lib.rs +expression: snapshot +input_file: crates/ruff_python_formatter/resources/test/fixtures/black/simple_cases/assert.py +--- +## Input + +```py +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment +``` + +## Black Differences + +```diff +--- Black ++++ Ruff +@@ -1,6 +1,8 @@ + assert ( + # Some comment + True # Some comment ++), ( + # Some comment +-), "Some string" # Some comment ++ "NOT_YET_IMPLEMENTED_STRING" ++) # Some comment + # Some comment +``` + +## Ruff Output + +```py +assert ( + # Some comment + True # Some comment +), ( + # Some comment + "NOT_YET_IMPLEMENTED_STRING" +) # Some comment +# Some comment +``` + +## Black Output + +```py +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment +``` + + diff --git a/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__ruff_test__statement__assert_py.snap b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__ruff_test__statement__assert_py.snap new file mode 100644 index 00000000000000..902f54a0a28964 --- /dev/null +++ b/crates/ruff_python_formatter/src/snapshots/ruff_python_formatter__tests__ruff_test__statement__assert_py.snap @@ -0,0 +1,27 @@ +--- +source: crates/ruff_python_formatter/src/lib.rs +expression: snapshot +--- +## Input +```py +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment +``` + + + +## Output +```py +assert ( + # Some comment + True # Some comment + # Some comment +), "Some string" # Some comment +# Some comment +``` + +