Debian Codegraph @

tests/data/cases/remove_lone_list_item_parens.py

raw
1 items = [(123)]
2 items = [(True)]
3 items = [(((((True)))))]
4 items = [(((((True,)))))]
5 items = [((((()))))]
6 items = [(x for x in [1])]
7 items = {(123)}
8 items = {(True)}
9 items = {(((((True)))))}
10
11 # Requires `hug_parens_with_braces_and_square_brackets` unstable style to remove parentheses
12 # around multiline values
13 items = [
14 (
15 {"key1": "val1", "key2": "val2", "key3": "val3"}
16 if some_var == "long strings"
17 else {"key": "val"}
18 )
19 ]
20 items = [
21 (
22 {"key1": "val1", "key2": "val2"}
23 if some_var == ""
24 else {"key": "val"}
25 )
26 ]
27
28 # Comments should not cause crashes
29 items = [
30 ( # comment
31 {"key1": "val1", "key2": "val2", "key3": "val3"}
32 if some_var == "long strings"
33 else {"key": "val"}
34 )
35 ]
36 items = [
37 (
38 {"key1": "val1", "key2": "val2", "key3": "val3"}
39 if some_var == "long strings"
40 else {"key": "val"}
41 ) # comment
42 ]
43
44 items = [ # comment
45 (
46 {"key1": "val1", "key2": "val2", "key3": "val3"}
47 if some_var == "long strings"
48 else {"key": "val"}
49 )
50 ]
51 items = [
52 (
53 {"key1": "val1", "key2": "val2", "key3": "val3"}
54 if some_var == "long strings"
55 else {"key": "val"}
56 )
57 ] # comment
58
59 items = [
60 (
61 {"key1": "val1", "key2": "val2", "key3": "val3"} # comment
62 if some_var == "long strings"
63 else {"key": "val"}
64 )
65 ]
66
67 items = [ # comment
68 ( # comment
69 {"key1": "val1", "key2": "val2", "key3": "val3"}
70 if some_var == "long strings"
71 else {"key": "val"}
72 )
73 ]
74 items = [
75 (
76 {"key1": "val1", "key2": "val2", "key3": "val3"}
77 if some_var == "long strings"
78 else {"key": "val"}
79 ) # comment
80 ] # comment
81
82
83 # output
84 items = [123]
85 items = [True]
86 items = [True]
87 items = [(True,)]
88 items = [()]
89 items = [(x for x in [1])]
90 items = {123}
91 items = {True}
92 items = {True}
93
94 # Requires `hug_parens_with_braces_and_square_brackets` unstable style to remove parentheses
95 # around multiline values
96 items = [
97 (
98 {"key1": "val1", "key2": "val2", "key3": "val3"}
99 if some_var == "long strings"
100 else {"key": "val"}
101 )
102 ]
103 items = [{"key1": "val1", "key2": "val2"} if some_var == "" else {"key": "val"}]
104
105 # Comments should not cause crashes
106 items = [
107 ( # comment
108 {"key1": "val1", "key2": "val2", "key3": "val3"}
109 if some_var == "long strings"
110 else {"key": "val"}
111 )
112 ]
113 items = [
114 (
115 {"key1": "val1", "key2": "val2", "key3": "val3"}
116 if some_var == "long strings"
117 else {"key": "val"}
118 ) # comment
119 ]
120
121 items = [ # comment
122 (
123 {"key1": "val1", "key2": "val2", "key3": "val3"}
124 if some_var == "long strings"
125 else {"key": "val"}
126 )
127 ]
128 items = [
129 (
130 {"key1": "val1", "key2": "val2", "key3": "val3"}
131 if some_var == "long strings"
132 else {"key": "val"}
133 )
134 ] # comment
135
136 items = [
137 (
138 {"key1": "val1", "key2": "val2", "key3": "val3"} # comment
139 if some_var == "long strings"
140 else {"key": "val"}
141 )
142 ]
143
144 items = [ # comment
145 ( # comment
146 {"key1": "val1", "key2": "val2", "key3": "val3"}
147 if some_var == "long strings"
148 else {"key": "val"}
149 )
150 ]
151 items = [
152 (
153 {"key1": "val1", "key2": "val2", "key3": "val3"}
154 if some_var == "long strings"
155 else {"key": "val"}
156 ) # comment
157 ] # comment