X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8a8c58252cc023ae250d6febd24f50a8166450d4..9e15cacc6708a7b0dd4d86c943b591bb66c28e29:/tests/data/fmtonoff.py diff --git a/tests/data/fmtonoff.py b/tests/data/fmtonoff.py index 373e5c7..35f2889 100644 --- a/tests/data/fmtonoff.py +++ b/tests/data/fmtonoff.py @@ -11,6 +11,10 @@ from third_party import (X, Y, Z) # fmt: on f'trigger 3.6 mode' +# Comment 1 + +# Comment 2 + # fmt: off def func_no_args(): a; b; c @@ -44,6 +48,39 @@ something = { # fmt: off key: 'value', } + +def subscriptlist(): + atom[ + # fmt: off + 'some big and', + 'complex subscript', + # fmt: on + goes + here, andhere, + ] + +def import_as_names(): + # fmt: off + from hello import a, b + 'unformatted' + # fmt: on + +def testlist_star_expr(): + # fmt: off + a , b = *hello + 'unformatted' + # fmt: on + +def yield_expr(): + # fmt: off + yield hello + 'unformatted' + # fmt: on + 'formatted' + # fmt: off + ( yield hello ) + 'unformatted' + # fmt: on + def example(session): # fmt: off result = session\ @@ -53,6 +90,27 @@ def example(session): .order_by(models.Customer.id.asc())\ .all() # fmt: on +def off_and_on_without_data(): + """All comments here are technically on the same prefix. + + The comments between will be formatted. This is a known limitation. + """ + # fmt: off + + + #hey, that won't work + + + # fmt: on + pass +def on_and_off_broken(): + """Another known limitation.""" + # fmt: on + # fmt: off + this=should.not_be.formatted() + but=it is formatted + because . the . handling . inside . generate_ignored_nodes() + doesnt . consider . ordering . within . one . prefix def long_lines(): if True: typedargslist.extend( @@ -117,6 +175,7 @@ cfg.rule( xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5 ) # fmt: off +yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1, @@ -138,6 +197,10 @@ from third_party import (X, Y, Z) # fmt: on f"trigger 3.6 mode" +# Comment 1 + +# Comment 2 + # fmt: off def func_no_args(): a; b; c @@ -190,6 +253,43 @@ something = { } +def subscriptlist(): + atom[ + # fmt: off + 'some big and', + 'complex subscript', + # fmt: on + goes + here, + andhere, + ] + + +def import_as_names(): + # fmt: off + from hello import a, b + 'unformatted' + # fmt: on + + +def testlist_star_expr(): + # fmt: off + a , b = *hello + 'unformatted' + # fmt: on + + +def yield_expr(): + # fmt: off + yield hello + 'unformatted' + # fmt: on + "formatted" + # fmt: off + ( yield hello ) + 'unformatted' + # fmt: on + + def example(session): # fmt: off result = session\ @@ -201,6 +301,29 @@ def example(session): # fmt: on +def off_and_on_without_data(): + """All comments here are technically on the same prefix. + + The comments between will be formatted. This is a known limitation. + """ + # fmt: off + + # hey, that won't work + + # fmt: on + pass + + +def on_and_off_broken(): + """Another known limitation.""" + # fmt: on + # fmt: off + this = should.not_be.formatted() + but = it is formatted + because.the.handling.inside.generate_ignored_nodes() + doesnt.consider.ordering.within.one.prefix + + def long_lines(): if True: typedargslist.extend( @@ -275,6 +398,7 @@ cfg.rule( xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5, ) # fmt: off +yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1,