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

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