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

Back out #850 (#1079)
[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,63 +29,96 @@
15  ~great
16  +value
17  -1
18  ~int and not v1 ^ 123 + v2 | True
19  (~int) and (not ((v1 ^ (123 + v2)) | True))
20 -+really ** -confusing ** ~operator ** -precedence
21 -flags & ~ select.EPOLLIN and waiters.write_task is not None
22 ++(really ** -(confusing ** ~(operator ** -precedence)))
23 +flags & ~select.EPOLLIN and waiters.write_task is not None
24  lambda arg: None
25  lambda a=True: a
26  lambda a, b, c=True: a
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 +lambda a, b, c=True, *, d=(1 << v2), e="str": a
30 +lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
31  manylambdas = lambda x=lambda y=lambda z=1: z: y(): x()
32 -foo = (lambda port_id, ignore_missing: {"port1": port1_resource, "port2": port2_resource}[port_id])
33 +foo = lambda port_id, ignore_missing: {
34 +    "port1": port1_resource,
35 +    "port2": port2_resource,
36 +}[port_id]
37  1 if True else 2
38  str or None if True else str or bytes or None
39  (str or None) if True else (str or bytes or None)
40  str or None if (1 if True else 2) else str or bytes or None
41  (str or None) if (1 if True else 2) else (str or bytes or None)
42 -((super_long_variable_name or None) if (1 if super_long_test_name else 2) else (str or bytes or None))
43 -{'2.7': dead, '3.7': (long_live or die_hard)}
44 -{'2.7': dead, '3.7': (long_live or die_hard), **{'3.6': verygood}}
45 +(
46 +    (super_long_variable_name or None)
47 +    if (1 if super_long_test_name else 2)
48 +    else (str or bytes or None)
49 +)
50 +{"2.7": dead, "3.7": (long_live or die_hard)}
51 +{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
52  {**a, **b, **c}
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 +{"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
56 +({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
57  ()
58  (1,)
59  (1, 2)
60  (1, 2, 3)
61  []
62  [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
63 -[1, 2, 3,]
64 +[
65 +    1,
66 +    2,
67 +    3,
68 +]
69  [*a]
70  [*range(10)]
71 -[*a, 4, 5,]
72 -[4, *a, 5,]
73 -[this_is_a_very_long_variable_which_will_force_a_delimiter_split, element, another, *more]
74 +[
75 +    *a,
76 +    4,
77 +    5,
78 +]
79 +[
80 +    4,
81 +    *a,
82 +    5,
83 +]
84 +[
85 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
86 +    element,
87 +    another,
88 +    *more,
89 +]
90  {i for i in (1, 2, 3)}
91  {(i ** 2) for i in (1, 2, 3)}
92 -{(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))}
93 +{(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
94  {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
95  [i for i in (1, 2, 3)]
96  [(i ** 2) for i in (1, 2, 3)]
97 -[(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))]
98 +[(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
99  [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
100  {i: 0 for i in (1, 2, 3)}
101 -{i: j for i, j in ((1, 'a'), (2, 'b'), (3, 'c'))}
102 +{i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
103  {a: b * 2 for a, b in dictionary.items()}
104  {a: b * -2 for a, b in dictionary.items()}
105 -{k: v for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension}
106 +{
107 +    k: v
108 +    for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
109 +}
110  Python3 > Python2 > COBOL
111  Life is Life
112  call()
113  call(arg)
114 -call(kwarg='hey')
115 -call(arg, kwarg='hey')
116 -call(arg, another, kwarg='hey', **kwargs)
117 -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
118 +call(kwarg="hey")
119 +call(arg, kwarg="hey")
120 +call(arg, another, kwarg="hey", **kwargs)
121 +call(
122 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
123 +    arg,
124 +    another,
125 +    kwarg="hey",
126 +    **kwargs
127 +)  # note: no trailing comma pre-3.6
128  call(*gidgets[:2])
129  call(a, *gidgets[:2])
130  call(**self.screen_kwargs)
131  call(b, **self.screen_kwargs)
132  lukasz.langa.pl
133 @@ -94,23 +127,25 @@
134  1.0 .real
135  ....__class__
136  list[str]
137  dict[str, int]
138  tuple[str, ...]
139 -tuple[str, int, float, dict[str, int],]
140 +tuple[
141 +    str, int, float, dict[str, int],
142 +]
143  very_long_variable_name_filters: t.List[
144      t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
145  ]
146  xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(  # type: ignore
147      sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
148  )
149  xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(  # type: ignore
150      sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
151  )
152 -xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
153 -    ..., List[SomeClass]
154 -] = classmethod(sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__))  # type: ignore
155 +xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod(
156 +    sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
157 +)  # type: ignore
158  slice[0]
159  slice[0:1]
160  slice[0:1:2]
161  slice[:]
162  slice[:-1]
163 @@ -134,113 +169,171 @@
164  numpy[-(c + 1) :, d]
165  numpy[:, l[-2]]
166  numpy[:, ::-1]
167  numpy[np.newaxis, :]
168  (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
169 -{'2.7': dead, '3.7': long_live or die_hard}
170 -{'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
171 +{"2.7": dead, "3.7": long_live or die_hard}
172 +{"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
173  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
174  (SomeName)
175  SomeName
176  (Good, Bad, Ugly)
177  (i for i in (1, 2, 3))
178  ((i ** 2) for i in (1, 2, 3))
179 -((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
180 +((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
181  (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
182  (*starred)
183 -{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
184 +{
185 +    "id": "1",
186 +    "type": "type",
187 +    "started_at": now(),
188 +    "ended_at": now() + timedelta(days=10),
189 +    "priority": 1,
190 +    "import_session_id": 1,
191 +    **kwargs,
192 +}
193  a = (1,)
194 -b = 1,
195 +b = (1,)
196  c = 1
197  d = (1,) + a + (2,)
198  e = (1,).count(1)
199  f = 1, *range(10)
200  g = 1, *"ten"
201 -what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
202 -what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
203 -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()
204 +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
205 +    vars_to_remove
206 +)
207 +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
208 +    vars_to_remove
209 +)
210 +result = (
211 +    session.query(models.Customer.id)
212 +    .filter(
213 +        models.Customer.account_id == account_id, models.Customer.email == email_address
214 +    )
215 +    .order_by(models.Customer.id.asc(),)
216 +    .all()
217 +)
218  Ø = set()
219  authors.łukasz.say_thanks()
220  mapping = {
221      A: 0.25 * (10.0 / 12),
222      B: 0.1 * (10.0 / 12),
223      C: 0.1 * (10.0 / 12),
224      D: 0.1 * (10.0 / 12),
225  }
226  
227 +
228  def gen():
229      yield from outside_of_generator
230 -    a = (yield)
231 -    b = ((yield))
232 -    c = (((yield)))
233 +    a = yield
234 +    b = yield
235 +    c = yield
236 +
237  
238  async def f():
239      await some.complicated[0].call(with_args=(True or (1 is not 1)))
240 -print(* [] or [1])
241 +
242 +
243 +print(*[] or [1])
244  print(**{1: 3} if False else {x: x for x in range(3)})
245 -print(* lambda x: x)
246 -assert(not Test),("Short message")
247 -assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
248 -assert(((parens is TooMany)))
249 -for x, in (1,), (2,), (3,): ...
250 -for y in (): ...
251 -for z in (i for i in (1, 2, 3)): ...
252 -for i in (call()): ...
253 -for j in (1 + (2 + 3)): ...
254 -while(this and that): ...
255 -for addr_family, addr_type, addr_proto, addr_canonname, addr_sockaddr in socket.getaddrinfo('google.com', 'http'):
256 +print(*lambda x: x)
257 +assert not Test, "Short message"
258 +assert this is ComplexTest and not requirements.fit_in_a_single_line(
259 +    force=False
260 +), "Short message"
261 +assert parens is TooMany
262 +for (x,) in (1,), (2,), (3,):
263 +    ...
264 +for y in ():
265 +    ...
266 +for z in (i for i in (1, 2, 3)):
267 +    ...
268 +for i in call():
269 +    ...
270 +for j in 1 + (2 + 3):
271 +    ...
272 +while this and that:
273 +    ...
274 +for (
275 +    addr_family,
276 +    addr_type,
277 +    addr_proto,
278 +    addr_canonname,
279 +    addr_sockaddr,
280 +) in socket.getaddrinfo("google.com", "http"):
281      pass
282 -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
283 -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
284 -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
285 -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
286 -if (
287 -    threading.current_thread() != threading.main_thread() and
288 -    threading.current_thread() != threading.main_thread() or
289 -    signal.getsignal(signal.SIGINT) != signal.default_int_handler
290 -):
291 -    return True
292 -if (
293 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
294 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
295 -):
296 -    return True
297 -if (
298 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
299 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
300 -):
301 -    return True
302 -if (
303 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
304 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
305 -):
306 -    return True
307 -if (
308 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
309 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
310 -):
311 -    return True
312 -if (
313 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
314 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
315 -):
316 -    return True
317 -if (
318 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
319 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
320 -):
321 -    return True
322 -if (
323 -    ~ 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
324 -):
325 -    return True
326 -if (
327 -    ~ 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
328 -):
329 -    return True
330 -if (
331 -    ~ 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
332 +a = (
333 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
334 +    in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
335 +)
336 +a = (
337 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
338 +    not in qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
339 +)
340 +a = (
341 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
342 +    is qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
343 +)
344 +a = (
345 +    aaaa.bbbb.cccc.dddd.eeee.ffff.gggg.hhhh.iiii.jjjj.kkkk.llll.mmmm.nnnn.oooo.pppp
346 +    is not qqqq.rrrr.ssss.tttt.uuuu.vvvv.xxxx.yyyy.zzzz
347 +)
348 +if (
349 +    threading.current_thread() != threading.main_thread()
350 +    and threading.current_thread() != threading.main_thread()
351 +    or signal.getsignal(signal.SIGINT) != signal.default_int_handler
352 +):
353 +    return True
354 +if (
355 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
356 +    | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
357 +):
358 +    return True
359 +if (
360 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
361 +    & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
362 +):
363 +    return True
364 +if (
365 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
366 +    + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
367 +):
368 +    return True
369 +if (
370 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
371 +    - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
372 +):
373 +    return True
374 +if (
375 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
376 +    * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
377 +):
378 +    return True
379 +if (
380 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
381 +    / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
382 +):
383 +    return True
384 +if (
385 +    ~aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e
386 +    | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
387 +):
388 +    return True
389 +if (
390 +    ~aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e
391 +    | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h
392 +    ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
393 +):
394 +    return True
395 +if (
396 +    ~aaaaaaaaaaaaaaaa.a
397 +    + aaaaaaaaaaaaaaaa.b
398 +    - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
399 +    | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
400 +    ^ aaaaaaaaaaaaaaaa.i
401 +    << aaaaaaaaaaaaaaaa.k
402 +    >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
403  ):
404      return True
405  last_call()
406  # standalone comment at ENDMARKER
407