]> 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:

[github action] display black result in job summary (#3688)
[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 # Regression test for https://github.com/psf/black/issues/3436.
79 if x:
80     return x
81 # fmt: off
82 elif   unformatted:
83 # fmt: on
84     will_be_formatted  ()
85
86
87 # output
88
89
90 # Regression test for https://github.com/psf/black/issues/3129.
91 setup(
92     entry_points={
93         # fmt: off
94         "console_scripts": [
95             "foo-bar"
96             "=foo.bar.:main",
97         # fmt: on
98             ]  # Includes an formatted indentation.
99     },
100 )
101
102
103 # Regression test for https://github.com/psf/black/issues/2015.
104 run(
105     # fmt: off
106     [
107         "ls",
108         "-la",
109     ]
110     # fmt: on
111     + path,
112     check=True,
113 )
114
115
116 # Regression test for https://github.com/psf/black/issues/3026.
117 def test_func():
118     # yapf: disable
119     if  unformatted(  args  ):
120         return True
121     # yapf: enable
122     elif b:
123         return True
124
125     return False
126
127
128 # Regression test for https://github.com/psf/black/issues/2567.
129 if True:
130     # fmt: off
131     for _ in range( 1 ):
132     # fmt: on
133         print ( "This won't be formatted" )
134     print ( "This won't be formatted either" )
135 else:
136     print("This will be formatted")
137
138
139 # Regression test for https://github.com/psf/black/issues/3184.
140 class A:
141     async def call(param):
142         if param:
143             # fmt: off
144             if param[0:4] in (
145                 "ABCD", "EFGH"
146             )  :
147                 # fmt: on
148                 print ( "This won't be formatted" )
149
150             elif param[0:4] in ("ZZZZ",):
151                 print ( "This won't be formatted either" )
152
153         print("This will be formatted")
154
155
156 # Regression test for https://github.com/psf/black/issues/2985.
157 class Named(t.Protocol):
158     # fmt: off
159     @property
160     def  this_wont_be_formatted ( self ) -> str: ...
161
162
163 class Factory(t.Protocol):
164     def this_will_be_formatted(self, **kwargs) -> Named:
165         ...
166
167     # fmt: on
168
169
170 # Regression test for https://github.com/psf/black/issues/3436.
171 if x:
172     return x
173 # fmt: off
174 elif   unformatted:
175     # fmt: on
176     will_be_formatted()