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

3d170ddbb3cfe093164803fc3a87e99e6b1159d2
[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,62 +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 -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, "port2": port2_resource
33 +}[
34 +    port_id
35 +]
36  1 if True else 2
37  str or None if True else str or bytes or None
38  (str or None) if True else (str or bytes or None)
39  str or None if (1 if True else 2) else str or bytes or None
40  (str or None) if (1 if True else 2) else (str or bytes or None)
41 -((super_long_variable_name or None) if (1 if super_long_test_name else 2) else (str or bytes or None))
42 -{'2.7': dead, '3.7': (long_live or die_hard)}
43 -{'2.7': dead, '3.7': (long_live or die_hard), **{'3.6': verygood}}
44 +(
45 +    (super_long_variable_name or None)
46 +    if (1 if super_long_test_name else 2)
47 +    else (str or bytes or None)
48 +)
49 +{"2.7": dead, "3.7": (long_live or die_hard)}
50 +{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
51  {**a, **b, **c}
52 -{'2.7', '3.6', '3.7', '3.8', '3.9', ('4.0' if gilectomy else '3.10')}
53 -({'a': 'b'}, (True or False), (+value), 'string', b'bytes') or None
54 +{"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
55 +({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
56  ()
57  (1,)
58  (1, 2)
59  (1, 2, 3)
60  []
61  [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
62 -[1, 2, 3,]
63 +[1, 2, 3]
64  [*a]
65  [*range(10)]
66 -[*a, 4, 5,]
67 -[4, *a, 5,]
68 -[this_is_a_very_long_variable_which_will_force_a_delimiter_split, element, another, *more]
69 +[*a, 4, 5]
70 +[4, *a, 5]
71 +[
72 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
73 +    element,
74 +    another,
75 +    *more,
76 +]
77  {i for i in (1, 2, 3)}
78  {(i ** 2) for i in (1, 2, 3)}
79 -{(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))}
80 +{(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
81  {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
82  [i for i in (1, 2, 3)]
83  [(i ** 2) for i in (1, 2, 3)]
84 -[(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))]
85 +[(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
86  [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
87  {i: 0 for i in (1, 2, 3)}
88 -{i: j for i, j in ((1, 'a'), (2, 'b'), (3, 'c'))}
89 +{i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
90  {a: b * 2 for a, b in dictionary.items()}
91  {a: b * -2 for a, b in dictionary.items()}
92 -{k: v for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension}
93 +{
94 +    k: v
95 +    for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
96 +}
97  Python3 > Python2 > COBOL
98  Life is Life
99  call()
100  call(arg)
101 -call(kwarg='hey')
102 -call(arg, kwarg='hey')
103 -call(arg, another, kwarg='hey', **kwargs)
104 -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
105 +call(kwarg="hey")
106 +call(arg, kwarg="hey")
107 +call(arg, another, kwarg="hey", **kwargs)
108 +call(
109 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
110 +    arg,
111 +    another,
112 +    kwarg="hey",
113 +    **kwargs
114 +)  # note: no trailing comma pre-3.6
115  call(*gidgets[:2])
116  call(a, *gidgets[:2])
117  call(**self.screen_kwargs)
118  call(b, **self.screen_kwargs)
119  lukasz.langa.pl
120 @@ -93,11 +115,11 @@
121  1.0 .real
122  ....__class__
123  list[str]
124  dict[str, int]
125  tuple[str, ...]
126 -tuple[str, int, float, dict[str, int],]
127 +tuple[str, int, float, dict[str, int]]
128  very_long_variable_name_filters: t.List[
129      t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
130  ]
131  slice[0]
132  slice[0:1]
133 @@ -124,103 +146,140 @@
134  numpy[-(c + 1) :, d]
135  numpy[:, l[-2]]
136  numpy[:, ::-1]
137  numpy[np.newaxis, :]
138  (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
139 -{'2.7': dead, '3.7': long_live or die_hard}
140 -{'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
141 +{"2.7": dead, "3.7": long_live or die_hard}
142 +{"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
143  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
144  (SomeName)
145  SomeName
146  (Good, Bad, Ugly)
147  (i for i in (1, 2, 3))
148  ((i ** 2) for i in (1, 2, 3))
149 -((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
150 +((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
151  (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
152  (*starred)
153 -{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}
154 +{
155 +    "id": "1",
156 +    "type": "type",
157 +    "started_at": now(),
158 +    "ended_at": now() + timedelta(days=10),
159 +    "priority": 1,
160 +    "import_session_id": 1,
161 +    **kwargs,
162 +}
163  a = (1,)
164 -b = 1,
165 +b = (1,)
166  c = 1
167  d = (1,) + a + (2,)
168  e = (1,).count(1)
169 -what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
170 -what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
171 -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()
172 +what_is_up_with_those_new_coord_names = (
173 +    (coord_names + set(vars_to_create)) + set(vars_to_remove)
174 +)
175 +what_is_up_with_those_new_coord_names = (
176 +    (coord_names | set(vars_to_create)) - set(vars_to_remove)
177 +)
178 +result = session.query(models.Customer.id).filter(
179 +    models.Customer.account_id == account_id, models.Customer.email == email_address
180 +).order_by(
181 +    models.Customer.id.asc()
182 +).all()
183  Ø = set()
184  authors.łukasz.say_thanks()
185  mapping = {
186      A: 0.25 * (10.0 / 12),
187      B: 0.1 * (10.0 / 12),
188      C: 0.1 * (10.0 / 12),
189      D: 0.1 * (10.0 / 12),
190  }
191  
192 +
193  def gen():
194      yield from outside_of_generator
195 -    a = (yield)
196 +    a = yield
197 +
198  
199  async def f():
200      await some.complicated[0].call(with_args=(True or (1 is not 1)))
201 -print(* [] or [1])
202 +
203 +
204 +print(*[] or [1])
205  print(**{1: 3} if False else {x: x for x in range(3)})
206 -print(* lambda x: x)
207 -assert(not Test),("Short message")
208 -assert this is ComplexTest and not requirements.fit_in_a_single_line(force=False), "Short message"
209 -assert(((parens is TooMany)))
210 -for x, in (1,), (2,), (3,): ...
211 -for y in (): ...
212 -for z in (i for i in (1, 2, 3)): ...
213 -for i in (call()): ...
214 -for j in (1 + (2 + 3)): ...
215 -while(this and that): ...
216 -if (
217 -    threading.current_thread() != threading.main_thread() and
218 -    threading.current_thread() != threading.main_thread() or
219 -    signal.getsignal(signal.SIGINT) != signal.default_int_handler
220 -):
221 -    return True
222 -if (
223 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
224 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
225 -):
226 -    return True
227 -if (
228 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
229 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
230 -):
231 -    return True
232 -if (
233 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
234 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
235 -):
236 -    return True
237 -if (
238 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
239 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
240 -):
241 -    return True
242 -if (
243 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
244 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
245 -):
246 -    return True
247 -if (
248 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
249 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
250 -):
251 -    return True
252 -if (
253 -    ~ 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
254 -):
255 -    return True
256 -if (
257 -    ~ 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
258 -):
259 -    return True
260 -if (
261 -    ~ 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
262 +print(*lambda x: x)
263 +assert not Test, "Short message"
264 +assert (
265 +    this is ComplexTest and not requirements.fit_in_a_single_line(force=False)
266 +), "Short message"
267 +assert parens is TooMany
268 +for (x,) in (1,), (2,), (3,):
269 +    ...
270 +for y in ():
271 +    ...
272 +for z in (i for i in (1, 2, 3)):
273 +    ...
274 +for i in call():
275 +    ...
276 +for j in 1 + (2 + 3):
277 +    ...
278 +while this and that:
279 +    ...
280 +if (
281 +    threading.current_thread() != threading.main_thread()
282 +    and threading.current_thread() != threading.main_thread()
283 +    or signal.getsignal(signal.SIGINT) != signal.default_int_handler
284 +):
285 +    return True
286 +if (
287 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
288 +    | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
289 +):
290 +    return True
291 +if (
292 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
293 +    & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
294 +):
295 +    return True
296 +if (
297 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
298 +    + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
299 +):
300 +    return True
301 +if (
302 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
303 +    - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
304 +):
305 +    return True
306 +if (
307 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
308 +    * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
309 +):
310 +    return True
311 +if (
312 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
313 +    / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
314 +):
315 +    return True
316 +if (
317 +    ~aaaa.a + aaaa.b - aaaa.c * aaaa.d / aaaa.e
318 +    | aaaa.f & aaaa.g % aaaa.h ^ aaaa.i << aaaa.k >> aaaa.l ** aaaa.m // aaaa.n
319 +):
320 +    return True
321 +if (
322 +    ~aaaaaaaa.a + aaaaaaaa.b - aaaaaaaa.c @ aaaaaaaa.d / aaaaaaaa.e
323 +    | aaaaaaaa.f & aaaaaaaa.g % aaaaaaaa.h
324 +    ^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l ** aaaaaaaa.m // aaaaaaaa.n
325 +):
326 +    return True
327 +if (
328 +    ~aaaaaaaaaaaaaaaa.a
329 +    + aaaaaaaaaaaaaaaa.b
330 +    - aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
331 +    | aaaaaaaaaaaaaaaa.f & aaaaaaaaaaaaaaaa.g % aaaaaaaaaaaaaaaa.h
332 +    ^ aaaaaaaaaaaaaaaa.i
333 +    << aaaaaaaaaaaaaaaa.k
334 +    >> aaaaaaaaaaaaaaaa.l ** aaaaaaaaaaaaaaaa.m // aaaaaaaaaaaaaaaa.n
335  ):
336      return True
337  last_call()
338  # standalone comment at ENDMARKER