From 76e2795141a7674547fd079f1e09d36c1d6e9944 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Mon, 11 Dec 2023 12:30:29 -0500 Subject: [PATCH] ruff_python_formatter: run existing tests with "dynamic" setting This tests the "dynamic" line width mode. As with the fixed line width setting, not much changes here since most of our code examples use very short lines. In a subsequent commit, we'll add more tests specifically targeted at line width. --- .../test/fixtures/ruff/docstring_code_examples.options.json | 2 +- .../tests/snapshots/format@docstring_code_examples.py.snap | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples.options.json b/crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples.options.json index 820ec052fd0dc8..9400ae4bea2300 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples.options.json +++ b/crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring_code_examples.options.json @@ -47,7 +47,7 @@ }, { "docstring_code": "enabled", - "docstring_code_line_width": 88, + "docstring_code_line_width": "dynamic", "indent_style": "space", "indent_width": 4 } diff --git a/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples.py.snap index a0e519c7fbb30f..b93825ea198e66 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@docstring_code_examples.py.snap @@ -13682,7 +13682,7 @@ quote-style = Double line-ending = LineFeed magic-trailing-comma = Respect docstring-code = Enabled -docstring-code-line-width = 88 +docstring-code-line-width = "dynamic" preview = Disabled ``` @@ -13926,7 +13926,9 @@ def doctest_long_lines(): This won't get wrapped even though it exceeds our configured line width because it doesn't exceed the line width within this docstring. e.g, the `f` in `foo` is treated as the first column. - >>> foo, bar, quux = this_is_a_long_line(lion, giraffe, hippo, zeba, lemur, penguin, monkey) + >>> foo, bar, quux = this_is_a_long_line( + ... lion, giraffe, hippo, zeba, lemur, penguin, monkey + ... ) But this one is long enough to get wrapped. >>> foo, bar, quux = this_is_a_long_line(