]> git.madduck.net Git - etc/vim.git/blob - tests/expression.diff

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:

Do not enforce empty lines after control flow statements
[etc/vim.git] / tests / expression.diff
1 --- <stdin>  (original)
2 +++ <stdin>  (formatted)
3 @@ -1,8 +1,8 @@
4  ...
5 -'some_string'
6 -b'\\xa3'
7 +"some_string"
8 +b"\\xa3"
9  Name
10  None
11  True
12  False
13  1
14 @@ -29,61 +29,83 @@
15  ~great
16  +value
17  -1
18  ~int and not v1 ^ 123 + v2 | True
19  (~int) and (not ((v1 ^ (123 + v2)) | True))
20 -flags & ~ select.EPOLLIN and waiters.write_task is not None
21 +flags & ~select.EPOLLIN and waiters.write_task is not None
22  lambda arg: None
23  lambda a=True: a
24  lambda a, b, c=True: a
25 -lambda a, b, c=True, *, d=(1 << v2), e='str': a
26 -lambda a, b, c=True, *vararg, d=(v1 << 2), e='str', **kwargs: a + b
27 -foo = (lambda port_id, ignore_missing: {"port1": port1_resource, "port2": port2_resource}[port_id])
28 +lambda a, b, c=True, *, d=(1 << v2), e="str": a
29 +lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
30 +foo = (
31 +    lambda port_id, ignore_missing: {"port1": port1_resource, "port2": port2_resource}[
32 +        port_id
33 +    ]
34 +)
35  1 if True else 2
36  str or None if True else str or bytes or None
37  (str or None) if True else (str or bytes or None)
38  str or None if (1 if True else 2) else str or bytes or None
39  (str or None) if (1 if True else 2) else (str or bytes or None)
40 -((super_long_variable_name or None) if (1 if super_long_test_name else 2) else (str or bytes or None))
41 -{'2.7': dead, '3.7': (long_live or die_hard)}
42 -{'2.7': dead, '3.7': (long_live or die_hard), **{'3.6': verygood}}
43 +(
44 +    (super_long_variable_name or None)
45 +    if (1 if super_long_test_name else 2)
46 +    else (str or bytes or None)
47 +)
48 +{"2.7": dead, "3.7": (long_live or die_hard)}
49 +{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
50  {**a, **b, **c}
51 -{'2.7', '3.6', '3.7', '3.8', '3.9', ('4.0' if gilectomy else '3.10')}
52 -({'a': 'b'}, (True or False), (+value), 'string', b'bytes') or None
53 +{"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
54 +({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
55  ()
56  (1,)
57  (1, 2)
58  (1, 2, 3)
59  []
60  [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
61 -[1, 2, 3,]
62 +[1, 2, 3]
63  [*a]
64  [*range(10)]
65 -[*a, 4, 5,]
66 -[4, *a, 5,]
67 -[this_is_a_very_long_variable_which_will_force_a_delimiter_split, element, another, *more]
68 +[*a, 4, 5]
69 +[4, *a, 5]
70 +[
71 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
72 +    element,
73 +    another,
74 +    *more,
75 +]
76  {i for i in (1, 2, 3)}
77  {(i ** 2) for i in (1, 2, 3)}
78 -{(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))}
79 +{(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
80  {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
81  [i for i in (1, 2, 3)]
82  [(i ** 2) for i in (1, 2, 3)]
83 -[(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))]
84 +[(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
85  [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
86  {i: 0 for i in (1, 2, 3)}
87 -{i: j for i, j in ((1, 'a'), (2, 'b'), (3, 'c'))}
88 +{i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
89  {a: b * 2 for a, b in dictionary.items()}
90  {a: b * -2 for a, b in dictionary.items()}
91 -{k: v for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension}
92 +{
93 +    k: v
94 +    for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
95 +}
96  Python3 > Python2 > COBOL
97  Life is Life
98  call()
99  call(arg)
100 -call(kwarg='hey')
101 -call(arg, kwarg='hey')
102 -call(arg, another, kwarg='hey', **kwargs)
103 -call(this_is_a_very_long_variable_which_will_force_a_delimiter_split, arg, another, kwarg='hey', **kwargs)  # note: no trailing comma pre-3.6
104 +call(kwarg="hey")
105 +call(arg, kwarg="hey")
106 +call(arg, another, kwarg="hey", **kwargs)
107 +call(
108 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
109 +    arg,
110 +    another,
111 +    kwarg="hey",
112 +    **kwargs
113 +)  # note: no trailing comma pre-3.6
114  call(*gidgets[:2])
115  call(a, *gidgets[:2])
116  call(**self.screen_kwargs)
117  call(b, **self.screen_kwargs)
118  lukasz.langa.pl
119 @@ -92,11 +114,11 @@
120  1.0 .real
121  ....__class__
122  list[str]
123  dict[str, int]
124  tuple[str, ...]
125 -tuple[str, int, float, dict[str, int],]
126 +tuple[str, int, float, dict[str, int]]
127  very_long_variable_name_filters: t.List[
128      t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
129  ]
130  slice[0]
131  slice[0:1]
132 @@ -123,88 +145,114 @@
133  numpy[-(c + 1):, d]
134  numpy[:, l[-2]]
135  numpy[:, ::-1]
136  numpy[np.newaxis, :]
137  (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
138 -{'2.7': dead, '3.7': long_live or die_hard}
139 -{'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
140 +{"2.7": dead, "3.7": long_live or die_hard}
141 +{"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
142  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
143  (SomeName)
144  SomeName
145  (Good, Bad, Ugly)
146  (i for i in (1, 2, 3))
147  ((i ** 2) for i in (1, 2, 3))
148 -((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
149 +((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
150  (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
151  (*starred)
152 -{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
153 +{
154 +    "id": "1",
155 +    "type": "type",
156 +    "started_at": now(),
157 +    "ended_at": now() + timedelta(days=10),
158 +    "priority": 1,
159 +    "import_session_id": 1,
160 +    **kwargs,
161 +}
162  a = (1,)
163  b = 1,
164  c = 1
165  d = (1,) + a + (2,)
166  e = (1,).count(1)
167 -what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
168 -what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
169 -result = session.query(models.Customer.id).filter(models.Customer.account_id == account_id, models.Customer.email == email_address).order_by(models.Customer.id.asc(),).all()
170 +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
171 +    vars_to_remove
172 +)
173 +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
174 +    vars_to_remove
175 +)
176 +result = session.query(models.Customer.id).filter(
177 +    models.Customer.account_id == account_id, models.Customer.email == email_address
178 +).order_by(
179 +    models.Customer.id.asc()
180 +).all()
181  Ø = set()
182  authors.łukasz.say_thanks()
183  mapping = {
184      A: 0.25 * (10.0 / 12),
185      B: 0.1 * (10.0 / 12),
186      C: 0.1 * (10.0 / 12),
187      D: 0.1 * (10.0 / 12),
188  }
189  
190 +
191  def gen():
192      yield from outside_of_generator
193      a = (yield)
194  
195 +
196  async def f():
197      await some.complicated[0].call(with_args=(True or (1 is not 1)))
198 -print(* [] or [1])
199 +
200 +
201 +print(*[] or [1])
202  print(**{1: 3} if False else {x: x for x in range(3)})
203 -print(* lambda x: x)
204 -for x, in (1,), (2,), (3,): ...
205 -for y in (): ...
206 -for z in (i for i in (1, 2, 3)): ...
207 -for i in (call()): ...
208 -for j in (1 + (2 + 3)): ...
209 -while(this and that): ...
210 -if (
211 -    threading.current_thread() != threading.main_thread() and
212 -    threading.current_thread() != threading.main_thread() or
213 -    signal.getsignal(signal.SIGINT) != signal.default_int_handler
214 -):
215 -    return True
216 -if (
217 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
218 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
219 -):
220 -    return True
221 -if (
222 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
223 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
224 -):
225 -    return True
226 -if (
227 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
228 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
229 -):
230 -    return True
231 -if (
232 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
233 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
234 -):
235 -    return True
236 -if (
237 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
238 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
239 -):
240 -    return True
241 -if (
242 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
243 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
244 +print(*lambda x: x)
245 +for (x,) in (1,), (2,), (3,):
246 +    ...
247 +for y in ():
248 +    ...
249 +for z in (i for i in (1, 2, 3)):
250 +    ...
251 +for i in call():
252 +    ...
253 +for j in 1 + (2 + 3):
254 +    ...
255 +while this and that:
256 +    ...
257 +if (
258 +    threading.current_thread() != threading.main_thread()
259 +    and threading.current_thread() != threading.main_thread()
260 +    or signal.getsignal(signal.SIGINT) != signal.default_int_handler
261 +):
262 +    return True
263 +if (
264 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
265 +    | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
266 +):
267 +    return True
268 +if (
269 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
270 +    & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
271 +):
272 +    return True
273 +if (
274 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
275 +    + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
276 +):
277 +    return True
278 +if (
279 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
280 +    - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
281 +):
282 +    return True
283 +if (
284 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
285 +    * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
286 +):
287 +    return True
288 +if (
289 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
290 +    / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
291  ):
292      return True
293  last_call()
294  # standalone comment at ENDMARKER