|
1 | 1 | ---
|
2 | 2 | source: crates/ruff_python_formatter/tests/fixtures.rs
|
3 |
| -input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/assign_breaking.py |
| 3 | +input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/preview.py |
4 | 4 | ---
|
5 | 5 | ## Input
|
6 | 6 | ```py
|
7 |
| -# Below is black stable style |
8 |
| -# In preview style, black always breaks the right side first |
| 7 | +""" |
| 8 | +Black's `Preview.module_docstring_newlines` |
| 9 | +""" |
| 10 | +first_stmt_after_module_level_docstring = 1 |
9 | 11 |
|
10 |
| -if True: |
| 12 | +
|
| 13 | +class CachedRepository: |
| 14 | + # Black's `Preview.dummy_implementations` |
| 15 | + def get_release_info(self): ... |
| 16 | +
|
| 17 | +
|
| 18 | +def raw_docstring(): |
| 19 | +
|
| 20 | + r"""Black's `Preview.accept_raw_docstrings` |
| 21 | + a |
| 22 | + b |
| 23 | + """ |
| 24 | + pass |
| 25 | +
|
| 26 | +
|
| 27 | +def reference_docstring_newlines(): |
| 28 | +
|
| 29 | + """A regular docstring for comparison |
| 30 | + a |
| 31 | + b |
| 32 | + """ |
| 33 | + pass |
| 34 | +
|
| 35 | +
|
| 36 | +class RemoveNewlineBeforeClassDocstring: |
| 37 | +
|
| 38 | + """Black's `Preview.no_blank_line_before_class_docstring`""" |
| 39 | +
|
| 40 | +
|
| 41 | +def f(): |
| 42 | + """Black's `Preview.prefer_splitting_right_hand_side_of_assignments`""" |
11 | 43 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
12 | 44 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
13 | 45 | ] = cccccccc.ccccccccccccc.cccccccc
|
@@ -52,10 +84,41 @@ preview = Disabled
|
52 | 84 | ```
|
53 | 85 |
|
54 | 86 | ```py
|
55 |
| -# Below is black stable style |
56 |
| -# In preview style, black always breaks the right side first |
| 87 | +""" |
| 88 | +Black's `Preview.module_docstring_newlines` |
| 89 | +""" |
| 90 | +first_stmt_after_module_level_docstring = 1 |
| 91 | +
|
| 92 | +
|
| 93 | +class CachedRepository: |
| 94 | + # Black's `Preview.dummy_implementations` |
| 95 | + def get_release_info(self): |
| 96 | + ... |
| 97 | +
|
| 98 | +
|
| 99 | +def raw_docstring(): |
| 100 | + r"""Black's `Preview.accept_raw_docstrings` |
| 101 | + a |
| 102 | + b |
| 103 | + """ |
| 104 | + pass |
57 | 105 |
|
58 |
| -if True: |
| 106 | +
|
| 107 | +def reference_docstring_newlines(): |
| 108 | + """A regular docstring for comparison |
| 109 | + a |
| 110 | + b |
| 111 | + """ |
| 112 | + pass |
| 113 | +
|
| 114 | +
|
| 115 | +class RemoveNewlineBeforeClassDocstring: |
| 116 | +
|
| 117 | + """Black's `Preview.no_blank_line_before_class_docstring`""" |
| 118 | +
|
| 119 | +
|
| 120 | +def f(): |
| 121 | + """Black's `Preview.prefer_splitting_right_hand_side_of_assignments`""" |
59 | 122 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
60 | 123 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
61 | 124 | ] = cccccccc.ccccccccccccc.cccccccc
|
@@ -100,10 +163,40 @@ preview = Enabled
|
100 | 163 | ```
|
101 | 164 |
|
102 | 165 | ```py
|
103 |
| -# Below is black stable style |
104 |
| -# In preview style, black always breaks the right side first |
| 166 | +""" |
| 167 | +Black's `Preview.module_docstring_newlines` |
| 168 | +""" |
| 169 | +first_stmt_after_module_level_docstring = 1 |
| 170 | +
|
| 171 | +
|
| 172 | +class CachedRepository: |
| 173 | + # Black's `Preview.dummy_implementations` |
| 174 | + def get_release_info(self): ... |
| 175 | +
|
| 176 | +
|
| 177 | +def raw_docstring(): |
| 178 | + r"""Black's `Preview.accept_raw_docstrings` |
| 179 | + a |
| 180 | + b |
| 181 | + """ |
| 182 | + pass |
| 183 | +
|
| 184 | +
|
| 185 | +def reference_docstring_newlines(): |
| 186 | + """A regular docstring for comparison |
| 187 | + a |
| 188 | + b |
| 189 | + """ |
| 190 | + pass |
| 191 | +
|
| 192 | +
|
| 193 | +class RemoveNewlineBeforeClassDocstring: |
| 194 | +
|
| 195 | + """Black's `Preview.no_blank_line_before_class_docstring`""" |
| 196 | +
|
105 | 197 |
|
106 |
| -if True: |
| 198 | +def f(): |
| 199 | + """Black's `Preview.prefer_splitting_right_hand_side_of_assignments`""" |
107 | 200 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
|
108 | 201 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
109 | 202 | ] = cccccccc.ccccccccccccc.cccccccc
|
|
0 commit comments