Debian Codegraph @

tests/data/cases/prefer_rhs_split_reformatted.py

raw
1 # Test cases separate from `prefer_rhs_split.py` that contains unformatted source.
2
3 # Left hand side fits in a single line but will still be exploded by the
4 # magic trailing comma.
5 first_value, (m1, m2,), third_value = xxxxxx_yyyyyy_zzzzzz_wwwwww_uuuuuuu_vvvvvvvvvvv(
6 arg1,
7 arg2,
8 )
9
10 # Make when when the left side of assignment plus the opening paren "... = (" is
11 # exactly line length limit + 1, it won't be split like that.
12 xxxxxxxxx_yyy_zzzzzzzz[xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)] = 1
13
14 # Regression test for #1187
15 print(
16 dict(
17 a=1,
18 b=2 if some_kind_of_data is not None else some_other_kind_of_data, # some explanation of why this is actually necessary
19 c=3,
20 )
21 )
22
23 # output
24
25
26 # Test cases separate from `prefer_rhs_split.py` that contains unformatted source.
27
28 # Left hand side fits in a single line but will still be exploded by the
29 # magic trailing comma.
30 (
31 first_value,
32 (
33 m1,
34 m2,
35 ),
36 third_value,
37 ) = xxxxxx_yyyyyy_zzzzzz_wwwwww_uuuuuuu_vvvvvvvvvvv(
38 arg1,
39 arg2,
40 )
41
42 # Make when when the left side of assignment plus the opening paren "... = (" is
43 # exactly line length limit + 1, it won't be split like that.
44 xxxxxxxxx_yyy_zzzzzzzz[
45 xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
46 ] = 1
47
48 # Regression test for #1187
49 print(
50 dict(
51 a=1,
52 b=(
53 2 if some_kind_of_data is not None else some_other_kind_of_data
54 ), # some explanation of why this is actually necessary
55 c=3,
56 )
57 )