| 1 |
class MyClass: |
| 2 |
""" Multiline |
| 3 |
class docstring |
| 4 |
""" |
| 5 |
|
| 6 |
def method(self): |
| 7 |
"""Multiline |
| 8 |
method docstring |
| 9 |
""" |
| 10 |
pass |
| 11 |
|
| 12 |
|
| 13 |
def foo(): |
| 14 |
"""This is a docstring with |
| 15 |
some lines of text here |
| 16 |
""" |
| 17 |
return |
| 18 |
|
| 19 |
|
| 20 |
def bar(): |
| 21 |
'''This is another docstring |
| 22 |
with more lines of text |
| 23 |
''' |
| 24 |
return |
| 25 |
|
| 26 |
|
| 27 |
def baz(): |
| 28 |
'''"This" is a string with some |
| 29 |
embedded "quotes"''' |
| 30 |
return |
| 31 |
|
| 32 |
|
| 33 |
def troz(): |
| 34 |
'''Indentation with tabs |
| 35 |
is just as OK |
| 36 |
''' |
| 37 |
return |
| 38 |
|
| 39 |
|
| 40 |
def zort(): |
| 41 |
"""Another |
| 42 |
multiline |
| 43 |
docstring |
| 44 |
""" |
| 45 |
pass |
| 46 |
|
| 47 |
def poit(): |
| 48 |
""" |
| 49 |
Lorem ipsum dolor sit amet. |
| 50 |
|
| 51 |
Consectetur adipiscing elit: |
| 52 |
- sed do eiusmod tempor incididunt ut labore |
| 53 |
- dolore magna aliqua |
| 54 |
- enim ad minim veniam |
| 55 |
- quis nostrud exercitation ullamco laboris nisi |
| 56 |
- aliquip ex ea commodo consequat |
| 57 |
""" |
| 58 |
pass |
| 59 |
|
| 60 |
|
| 61 |
def under_indent(): |
| 62 |
""" |
| 63 |
These lines are indented in a way that does not |
| 64 |
make sense. |
| 65 |
""" |
| 66 |
pass |
| 67 |
|
| 68 |
|
| 69 |
def over_indent(): |
| 70 |
""" |
| 71 |
This has a shallow indent |
| 72 |
- But some lines are deeper |
| 73 |
- And the closing quote is too deep |
| 74 |
""" |
| 75 |
pass |
| 76 |
|
| 77 |
|
| 78 |
def single_line(): |
| 79 |
"""But with a newline after it! |
| 80 |
|
| 81 |
""" |
| 82 |
pass |
| 83 |
|
| 84 |
|
| 85 |
def this(): |
| 86 |
r""" |
| 87 |
'hey ho' |
| 88 |
""" |
| 89 |
|
| 90 |
|
| 91 |
def that(): |
| 92 |
""" "hey yah" """ |
| 93 |
|
| 94 |
|
| 95 |
def and_that(): |
| 96 |
""" |
| 97 |
"hey yah" """ |
| 98 |
|
| 99 |
|
| 100 |
def and_this(): |
| 101 |
''' |
| 102 |
"hey yah"''' |
| 103 |
|
| 104 |
|
| 105 |
def multiline_whitespace(): |
| 106 |
''' |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
''' |
| 112 |
|
| 113 |
|
| 114 |
def oneline_whitespace(): |
| 115 |
''' ''' |
| 116 |
|
| 117 |
|
| 118 |
def empty(): |
| 119 |
"""""" |
| 120 |
|
| 121 |
|
| 122 |
def single_quotes(): |
| 123 |
'testing' |
| 124 |
|
| 125 |
|
| 126 |
def believe_it_or_not_this_is_in_the_py_stdlib(): ''' |
| 127 |
"hey yah"''' |
| 128 |
|
| 129 |
|
| 130 |
def ignored_docstring(): |
| 131 |
"""a => \ |
| 132 |
b""" |
| 133 |
|
| 134 |
def single_line_docstring_with_whitespace(): |
| 135 |
""" This should be stripped """ |
| 136 |
|
| 137 |
def docstring_with_inline_tabs_and_space_indentation(): |
| 138 |
"""hey |
| 139 |
|
| 140 |
tab separated value |
| 141 |
tab at start of line and then a tab separated value |
| 142 |
multiple tabs at the beginning and inline |
| 143 |
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only. |
| 144 |
|
| 145 |
line ends with some tabs |
| 146 |
""" |
| 147 |
|
| 148 |
|
| 149 |
def docstring_with_inline_tabs_and_tab_indentation(): |
| 150 |
"""hey |
| 151 |
|
| 152 |
tab separated value |
| 153 |
tab at start of line and then a tab separated value |
| 154 |
multiple tabs at the beginning and inline |
| 155 |
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only. |
| 156 |
|
| 157 |
line ends with some tabs |
| 158 |
""" |
| 159 |
pass |
| 160 |
|
| 161 |
|
| 162 |
def backslash_space(): |
| 163 |
"""\ """ |
| 164 |
|
| 165 |
|
| 166 |
def multiline_backslash_1(): |
| 167 |
''' |
| 168 |
hey\there\ |
| 169 |
\ ''' |
| 170 |
|
| 171 |
|
| 172 |
def multiline_backslash_2(): |
| 173 |
''' |
| 174 |
hey there \ ''' |
| 175 |
|
| 176 |
# Regression test for #3425 |
| 177 |
def multiline_backslash_really_long_dont_crash(): |
| 178 |
""" |
| 179 |
hey there hello guten tag hi hoow are you ola zdravstvuyte ciao como estas ca va \ """ |
| 180 |
|
| 181 |
|
| 182 |
def multiline_backslash_3(): |
| 183 |
''' |
| 184 |
already escaped \\ ''' |
| 185 |
|
| 186 |
|
| 187 |
def my_god_its_full_of_stars_1(): |
| 188 |
"I'm sorry Dave\u2001" |
| 189 |
|
| 190 |
|
| 191 |
# the space below is actually a \u2001, removed in output |
| 192 |
def my_god_its_full_of_stars_2(): |
| 193 |
"I'm sorry Dave " |
| 194 |
|
| 195 |
|
| 196 |
def docstring_almost_at_line_limit(): |
| 197 |
"""long docstring.................................................................""" |
| 198 |
|
| 199 |
|
| 200 |
def docstring_almost_at_line_limit2(): |
| 201 |
"""long docstring................................................................. |
| 202 |
|
| 203 |
.................................................................................. |
| 204 |
""" |
| 205 |
|
| 206 |
|
| 207 |
def docstring_at_line_limit(): |
| 208 |
"""long docstring................................................................""" |
| 209 |
|
| 210 |
|
| 211 |
def multiline_docstring_at_line_limit(): |
| 212 |
"""first line----------------------------------------------------------------------- |
| 213 |
|
| 214 |
second line----------------------------------------------------------------------""" |
| 215 |
|
| 216 |
|
| 217 |
def stable_quote_normalization_with_immediate_inner_single_quote(self): |
| 218 |
''''<text here> |
| 219 |
|
| 220 |
<text here, since without another non-empty line black is stable> |
| 221 |
''' |
| 222 |
|
| 223 |
|
| 224 |
def foo(): |
| 225 |
""" |
| 226 |
Docstring with a backslash followed by a space\ |
| 227 |
and then another line |
| 228 |
""" |
| 229 |
|
| 230 |
# output |
| 231 |
|
| 232 |
class MyClass: |
| 233 |
"""Multiline |
| 234 |
class docstring |
| 235 |
""" |
| 236 |
|
| 237 |
def method(self): |
| 238 |
"""Multiline |
| 239 |
method docstring |
| 240 |
""" |
| 241 |
pass |
| 242 |
|
| 243 |
|
| 244 |
def foo(): |
| 245 |
"""This is a docstring with |
| 246 |
some lines of text here |
| 247 |
""" |
| 248 |
return |
| 249 |
|
| 250 |
|
| 251 |
def bar(): |
| 252 |
"""This is another docstring |
| 253 |
with more lines of text |
| 254 |
""" |
| 255 |
return |
| 256 |
|
| 257 |
|
| 258 |
def baz(): |
| 259 |
'''"This" is a string with some |
| 260 |
embedded "quotes"''' |
| 261 |
return |
| 262 |
|
| 263 |
|
| 264 |
def troz(): |
| 265 |
"""Indentation with tabs |
| 266 |
is just as OK |
| 267 |
""" |
| 268 |
return |
| 269 |
|
| 270 |
|
| 271 |
def zort(): |
| 272 |
"""Another |
| 273 |
multiline |
| 274 |
docstring |
| 275 |
""" |
| 276 |
pass |
| 277 |
|
| 278 |
|
| 279 |
def poit(): |
| 280 |
""" |
| 281 |
Lorem ipsum dolor sit amet. |
| 282 |
|
| 283 |
Consectetur adipiscing elit: |
| 284 |
- sed do eiusmod tempor incididunt ut labore |
| 285 |
- dolore magna aliqua |
| 286 |
- enim ad minim veniam |
| 287 |
- quis nostrud exercitation ullamco laboris nisi |
| 288 |
- aliquip ex ea commodo consequat |
| 289 |
""" |
| 290 |
pass |
| 291 |
|
| 292 |
|
| 293 |
def under_indent(): |
| 294 |
""" |
| 295 |
These lines are indented in a way that does not |
| 296 |
make sense. |
| 297 |
""" |
| 298 |
pass |
| 299 |
|
| 300 |
|
| 301 |
def over_indent(): |
| 302 |
""" |
| 303 |
This has a shallow indent |
| 304 |
- But some lines are deeper |
| 305 |
- And the closing quote is too deep |
| 306 |
""" |
| 307 |
pass |
| 308 |
|
| 309 |
|
| 310 |
def single_line(): |
| 311 |
"""But with a newline after it!""" |
| 312 |
pass |
| 313 |
|
| 314 |
|
| 315 |
def this(): |
| 316 |
r""" |
| 317 |
'hey ho' |
| 318 |
""" |
| 319 |
|
| 320 |
|
| 321 |
def that(): |
| 322 |
""" "hey yah" """ |
| 323 |
|
| 324 |
|
| 325 |
def and_that(): |
| 326 |
""" |
| 327 |
"hey yah" """ |
| 328 |
|
| 329 |
|
| 330 |
def and_this(): |
| 331 |
''' |
| 332 |
"hey yah"''' |
| 333 |
|
| 334 |
|
| 335 |
def multiline_whitespace(): |
| 336 |
""" """ |
| 337 |
|
| 338 |
|
| 339 |
def oneline_whitespace(): |
| 340 |
""" """ |
| 341 |
|
| 342 |
|
| 343 |
def empty(): |
| 344 |
"""""" |
| 345 |
|
| 346 |
|
| 347 |
def single_quotes(): |
| 348 |
"testing" |
| 349 |
|
| 350 |
|
| 351 |
def believe_it_or_not_this_is_in_the_py_stdlib(): |
| 352 |
''' |
| 353 |
"hey yah"''' |
| 354 |
|
| 355 |
|
| 356 |
def ignored_docstring(): |
| 357 |
"""a => \ |
| 358 |
b""" |
| 359 |
|
| 360 |
|
| 361 |
def single_line_docstring_with_whitespace(): |
| 362 |
"""This should be stripped""" |
| 363 |
|
| 364 |
|
| 365 |
def docstring_with_inline_tabs_and_space_indentation(): |
| 366 |
"""hey |
| 367 |
|
| 368 |
tab separated value |
| 369 |
tab at start of line and then a tab separated value |
| 370 |
multiple tabs at the beginning and inline |
| 371 |
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only. |
| 372 |
|
| 373 |
line ends with some tabs |
| 374 |
""" |
| 375 |
|
| 376 |
|
| 377 |
def docstring_with_inline_tabs_and_tab_indentation(): |
| 378 |
"""hey |
| 379 |
|
| 380 |
tab separated value |
| 381 |
tab at start of line and then a tab separated value |
| 382 |
multiple tabs at the beginning and inline |
| 383 |
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only. |
| 384 |
|
| 385 |
line ends with some tabs |
| 386 |
""" |
| 387 |
pass |
| 388 |
|
| 389 |
|
| 390 |
def backslash_space(): |
| 391 |
"""\ """ |
| 392 |
|
| 393 |
|
| 394 |
def multiline_backslash_1(): |
| 395 |
""" |
| 396 |
hey\there\ |
| 397 |
\ """ |
| 398 |
|
| 399 |
|
| 400 |
def multiline_backslash_2(): |
| 401 |
""" |
| 402 |
hey there \ """ |
| 403 |
|
| 404 |
|
| 405 |
# Regression test for #3425 |
| 406 |
def multiline_backslash_really_long_dont_crash(): |
| 407 |
""" |
| 408 |
hey there hello guten tag hi hoow are you ola zdravstvuyte ciao como estas ca va \ """ |
| 409 |
|
| 410 |
|
| 411 |
def multiline_backslash_3(): |
| 412 |
""" |
| 413 |
already escaped \\""" |
| 414 |
|
| 415 |
|
| 416 |
def my_god_its_full_of_stars_1(): |
| 417 |
"I'm sorry Dave\u2001" |
| 418 |
|
| 419 |
|
| 420 |
# the space below is actually a \u2001, removed in output |
| 421 |
def my_god_its_full_of_stars_2(): |
| 422 |
"I'm sorry Dave" |
| 423 |
|
| 424 |
|
| 425 |
def docstring_almost_at_line_limit(): |
| 426 |
"""long docstring.................................................................""" |
| 427 |
|
| 428 |
|
| 429 |
def docstring_almost_at_line_limit2(): |
| 430 |
"""long docstring................................................................. |
| 431 |
|
| 432 |
.................................................................................. |
| 433 |
""" |
| 434 |
|
| 435 |
|
| 436 |
def docstring_at_line_limit(): |
| 437 |
"""long docstring................................................................""" |
| 438 |
|
| 439 |
|
| 440 |
def multiline_docstring_at_line_limit(): |
| 441 |
"""first line----------------------------------------------------------------------- |
| 442 |
|
| 443 |
second line----------------------------------------------------------------------""" |
| 444 |
|
| 445 |
|
| 446 |
def stable_quote_normalization_with_immediate_inner_single_quote(self): |
| 447 |
"""'<text here> |
| 448 |
|
| 449 |
<text here, since without another non-empty line black is stable> |
| 450 |
""" |
| 451 |
|
| 452 |
|
| 453 |
def foo(): |
| 454 |
""" |
| 455 |
Docstring with a backslash followed by a space\ |
| 456 |
and then another line |
| 457 |
""" |