]> git.madduck.net Git - etc/vim.git/blob - tests/data/simple_cases/fmtonoff5.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix a crash when `# fmt: on` is used on a different block level than `# fmt: off...
[etc/vim.git] / tests / data / simple_cases / fmtonoff5.py
1 # Regression test for https://github.com/psf/black/issues/3129.
2 setup(
3     entry_points={
4         # fmt: off
5         "console_scripts": [
6             "foo-bar"
7             "=foo.bar.:main",
8         # fmt: on
9             ]  # Includes an formatted indentation.
10     },
11 )
12
13
14 # Regression test for https://github.com/psf/black/issues/2015.
15 run(
16     # fmt: off
17     [
18         "ls",
19         "-la",
20     ]
21     # fmt: on
22     + path,
23     check=True,
24 )
25
26
27 # Regression test for https://github.com/psf/black/issues/3026.
28 def test_func():
29     # yapf: disable
30     if  unformatted(  args  ):
31         return True
32     # yapf: enable
33     elif b:
34         return True
35
36     return False
37
38
39 # Regression test for https://github.com/psf/black/issues/2567.
40 if True:
41     # fmt: off
42     for _ in range( 1 ):
43     # fmt: on
44         print ( "This won't be formatted" )
45     print ( "This won't be formatted either" )
46 else:
47     print ( "This will be formatted" )
48
49
50 # Regression test for https://github.com/psf/black/issues/3184.
51 class A:
52     async def call(param):
53         if param:
54             # fmt: off
55             if param[0:4] in (
56                 "ABCD", "EFGH"
57             )  :
58                 # fmt: on
59                 print ( "This won't be formatted" )
60
61             elif param[0:4] in ("ZZZZ",):
62                 print ( "This won't be formatted either" )
63
64         print ( "This will be formatted" )
65
66
67 # Regression test for https://github.com/psf/black/issues/2985
68 class Named(t.Protocol):
69     # fmt: off
70     @property
71     def  this_wont_be_formatted ( self ) -> str: ...
72
73 class Factory(t.Protocol):
74     def  this_will_be_formatted ( self, **kwargs ) -> Named: ...
75     # fmt: on
76
77
78 # output
79
80
81 # Regression test for https://github.com/psf/black/issues/3129.
82 setup(
83     entry_points={
84         # fmt: off
85         "console_scripts": [
86             "foo-bar"
87             "=foo.bar.:main",
88         # fmt: on
89             ]  # Includes an formatted indentation.
90     },
91 )
92
93
94 # Regression test for https://github.com/psf/black/issues/2015.
95 run(
96     # fmt: off
97     [
98         "ls",
99         "-la",
100     ]
101     # fmt: on
102     + path,
103     check=True,
104 )
105
106
107 # Regression test for https://github.com/psf/black/issues/3026.
108 def test_func():
109     # yapf: disable
110     if  unformatted(  args  ):
111         return True
112     # yapf: enable
113     elif b:
114         return True
115
116     return False
117
118
119 # Regression test for https://github.com/psf/black/issues/2567.
120 if True:
121     # fmt: off
122     for _ in range( 1 ):
123     # fmt: on
124         print ( "This won't be formatted" )
125     print ( "This won't be formatted either" )
126 else:
127     print("This will be formatted")
128
129
130 # Regression test for https://github.com/psf/black/issues/3184.
131 class A:
132     async def call(param):
133         if param:
134             # fmt: off
135             if param[0:4] in (
136                 "ABCD", "EFGH"
137             )  :
138                 # fmt: on
139                 print ( "This won't be formatted" )
140
141             elif param[0:4] in ("ZZZZ",):
142                 print ( "This won't be formatted either" )
143
144         print("This will be formatted")
145
146
147 # Regression test for https://github.com/psf/black/issues/2985
148 class Named(t.Protocol):
149     # fmt: off
150     @property
151     def  this_wont_be_formatted ( self ) -> str: ...
152
153
154 class Factory(t.Protocol):
155     def this_will_be_formatted(self, **kwargs) -> Named:
156         ...
157
158     # fmt: on