]> git.madduck.net Git - etc/vim.git/blob - tests/data/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:

remove obviously unnecessary parentheses (#850)
[etc/vim.git] / tests / data / expression.diff
1 --- [Deterministic header]
2 +++ [Deterministic header]
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,62 +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 +lambda a, b, c=True, *, d=(1 << v2), e="str": a
28 +lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
29  manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
30 -foo = (lambda port_id, ignore_missing: {"port1": port1_resource, "port2": port2_resource}[port_id])
31 +foo = lambda port_id, ignore_missing: {
32 +    "port1": port1_resource,
33 +    "port2": port2_resource,
34 +}[port_id]
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 @@ -93,23 +114,25 @@
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  xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(  # type: ignore
131      sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
132  )
133 -xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(  # type: ignore
134 -    sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
135 -)
136  xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
137      ..., List[SomeClass]
138 -] = classmethod(sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__))  # type: ignore
139 +] = classmethod(  # type: ignore
140 +    sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
141 +)
142 +xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(
143 +    sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
144 +)  # type: ignore
145  slice[0]
146  slice[0:1]
147  slice[0:1:2]
148  slice[:]
149  slice[:-1]
150 @@ -133,113 +156,171 @@
151  numpy[-(c + 1) :, d]
152  numpy[:, l[-2]]
153  numpy[:, ::-1]
154  numpy[np.newaxis, :]
155  (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
156 -{'2.7': dead, '3.7': long_live or die_hard}
157 -{'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
158 +{"2.7": dead, "3.7": long_live or die_hard}
159 +{"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
160  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
161 -(SomeName)
162 +SomeName
163  SomeName
164  (Good, Bad, Ugly)
165  (i for i in (1, 2, 3))
166  ((i ** 2) for i in (1, 2, 3))
167 -((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
168 +((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
169  (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
170  (*starred)
171 -{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
172 +{
173 +    "id": "1",
174 +    "type": "type",
175 +    "started_at": now(),
176 +    "ended_at": now() + timedelta(days=10),
177 +    "priority": 1,
178 +    "import_session_id": 1,
179 +    **kwargs,
180 +}
181  a = (1,)
182 -b = 1,
183 +b = (1,)
184  c = 1
185  d = (1,) + a + (2,)
186  e = (1,).count(1)
187  f = 1, *range(10)
188  g = 1, *"ten"
189 -what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
190 -what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
191 -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()
192 +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
193 +    vars_to_remove
194 +)
195 +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
196 +    vars_to_remove
197 +)
198 +result = (
199 +    session.query(models.Customer.id)
200 +    .filter(
201 +        models.Customer.account_id == account_id, models.Customer.email == email_address
202 +    )
203 +    .order_by(models.Customer.id.asc())
204 +    .all()
205 +)
206  Ø = set()
207  authors.łukasz.say_thanks()
208  mapping = {
209      A: 0.25 * (10.0 / 12),
210      B: 0.1 * (10.0 / 12),
211      C: 0.1 * (10.0 / 12),
212      D: 0.1 * (10.0 / 12),
213  }
214  
215 +
216  def gen():
217      yield from outside_of_generator
218 -    a = (yield)
219 -    b = ((yield))
220 -    c = (((yield)))
221 +    a = yield
222 +    b = yield
223 +    c = yield
224 +
225  
226  async def f():
227      await some.complicated[0].call(with_args=(True or (1 is not 1)))
228 -print(* [] or [1])
229 +
230 +
231 +print(*[] or [1])
232  print(**{1: 3} if False else {x: x for x in range(3)})
233 -print(* lambda x: x)
234 -assert(not Test),("Short message")
235 -assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
236 -assert(((parens is TooMany)))
237 -for x, in (1,), (2,), (3,): ...
238 -for y in (): ...
239 -for z in (i for i in (1, 2, 3)): ...
240 -for i in (call()): ...
241 -for j in (1 + (2 + 3)): ...
242 -while(this and that): ...
243 -for addr_family, addr_type, addr_proto, addr_canonname, addr_sockaddr in socket.getaddrinfo('google.com', 'http'):
244 +print(*lambda x: x)
245 +assert not Test, "Short message"
246 +assert this is ComplexTest and not requirements.fit_in_a_single_line(
247 +    force=False
248 +), "Short message"
249 +assert parens is TooMany
250 +for (x,) in (1,), (2,), (3,):
251 +    ...
252 +for y in ():
253 +    ...
254 +for z in (i for i in (1, 2, 3)):
255 +    ...
256 +for i in call():
257 +    ...
258 +for j in 1 + (2 + 3):
259 +    ...
260 +while this and that:
261 +    ...
262 +for (
263 +    addr_family,
264 +    addr_type,
265 +    addr_proto,
266 +    addr_canonname,
267 +    addr_sockaddr,
268 +) in socket.getaddrinfo("google.com", "http"):
269      pass
270 -a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
271 -a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
272 -a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
273 -a = aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
274 -if (
275 -    threading.current_thread() != threading.main_thread() and
276 -    threading.current_thread() != threading.main_thread() or
277 -    signal.getsignal(signal.SIGINT) != signal.default_int_handler
278 -):
279 -    return True
280 -if (
281 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
282 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
283 -):
284 -    return True
285 -if (
286 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
287 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
288 -):
289 -    return True
290 -if (
291 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
292 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
293 -):
294 -    return True
295 -if (
296 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
297 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
298 -):
299 -    return True
300 -if (
301 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
302 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
303 -):
304 -    return True
305 -if (
306 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
307 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
308 -):
309 -    return True
310 -if (
311 -    ~ aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
312 -):
313 -    return True
314 -if (
315 -    ~ aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
316 -):
317 -    return True
318 -if (
319 -    ~ aaaaaaaaaaaaaaaa.a + aaaaaaaaaaaaaaaa.b - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h ^ aaaaaaaaaaaaaaaa.i << aaaaaaaaaaaaaaaa.k >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
320 +a = (
321 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
322 +    in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
323 +)
324 +a = (
325 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
326 +    not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
327 +)
328 +a = (
329 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
330 +    is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
331 +)
332 +a = (
333 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
334 +    is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
335 +)
336 +if (
337 +    threading.current_thread() != threading.main_thread()
338 +    and threading.current_thread() != threading.main_thread()
339 +    or signal.getsignal(signal.SIGINT) != signal.default_int_handler
340 +):
341 +    return True
342 +if (
343 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
344 +    | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
345 +):
346 +    return True
347 +if (
348 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
349 +    & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
350 +):
351 +    return True
352 +if (
353 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
354 +    + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
355 +):
356 +    return True
357 +if (
358 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
359 +    - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
360 +):
361 +    return True
362 +if (
363 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
364 +    * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
365 +):
366 +    return True
367 +if (
368 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
369 +    / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
370 +):
371 +    return True
372 +if (
373 +    ~aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e
374 +    | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
375 +):
376 +    return True
377 +if (
378 +    ~aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e
379 +    | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h
380 +    ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
381 +):
382 +    return True
383 +if (
384 +    ~aaaaaaaaaaaaaaaa.a
385 +    + aaaaaaaaaaaaaaaa.b
386 +    - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
387 +    | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
388 +    ^ aaaaaaaaaaaaaaaa.i
389 +    << aaaaaaaaaaaaaaaa.k
390 +    >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
391  ):
392      return True
393  last_call()
394  # standalone comment at ENDMARKER