Debian Codegraph @

tests/data/cases/trailing_commas_in_leading_parts.py

raw
1 zero(one,).two(three,).four(five,)
2
3 func1(arg1).func2(arg2,).func3(arg3).func4(arg4,).func5(arg5)
4
5 # Inner one-element tuple shouldn't explode
6 func1(arg1).func2(arg1, (one_tuple,)).func3(arg3)
7
8 (a, b, c, d,) = func1(arg1) and func2(arg2)
9
10
11 # Example from https://github.com/psf/black/issues/3229
12 def refresh_token(self, device_family, refresh_token, api_key):
13 return self.orchestration.refresh_token(
14 data={
15 "refreshToken": refresh_token,
16 },
17 api_key=api_key,
18 )["extensions"]["sdk"]["token"]
19
20
21 # Edge case where a bug in a working-in-progress version of
22 # https://github.com/psf/black/pull/3370 causes an infinite recursion.
23 assert (
24 long_module.long_class.long_func().another_func()
25 == long_module.long_class.long_func()["some_key"].another_func(arg1)
26 )
27
28 # Regression test for https://github.com/psf/black/issues/3414.
29 assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
30 xxxxxxxxx
31 ).xxxxxxxxxxxxxxxxxx(), (
32 "xxx {xxxxxxxxx} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
33 )
34
35
36 # output
37
38
39 zero(
40 one,
41 ).two(
42 three,
43 ).four(
44 five,
45 )
46
47 func1(arg1).func2(
48 arg2,
49 ).func3(arg3).func4(
50 arg4,
51 ).func5(arg5)
52
53 # Inner one-element tuple shouldn't explode
54 func1(arg1).func2(arg1, (one_tuple,)).func3(arg3)
55
56 (
57 a,
58 b,
59 c,
60 d,
61 ) = func1(
62 arg1
63 ) and func2(arg2)
64
65
66 # Example from https://github.com/psf/black/issues/3229
67 def refresh_token(self, device_family, refresh_token, api_key):
68 return self.orchestration.refresh_token(
69 data={
70 "refreshToken": refresh_token,
71 },
72 api_key=api_key,
73 )["extensions"]["sdk"]["token"]
74
75
76 # Edge case where a bug in a working-in-progress version of
77 # https://github.com/psf/black/pull/3370 causes an infinite recursion.
78 assert (
79 long_module.long_class.long_func().another_func()
80 == long_module.long_class.long_func()["some_key"].another_func(arg1)
81 )
82
83 # Regression test for https://github.com/psf/black/issues/3414.
84 assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
85 xxxxxxxxx
86 ).xxxxxxxxxxxxxxxxxx(), (
87 "xxx {xxxxxxxxx} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
88 )