-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remove parenthesis around sole list items
Signed-off-by: cobalt <[email protected]>
- Loading branch information
Showing
6 changed files
with
228 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
tests/data/cases/preview_remove_sole_list_item_parens.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# flags: --unstable | ||
items = [ | ||
( | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else { "key": "val" } | ||
) | ||
] | ||
items = [ | ||
( | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else { "key": "val" } | ||
), | ||
] | ||
items = [( | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else { "key": "val" } | ||
)] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else {"key": "val"} | ||
] | ||
items = [ | ||
( | ||
{"key1": "val1", "key2": "val2"} if some_var == "longstring" else { "key": "val" } | ||
) | ||
] | ||
items = [( | ||
{"key1": "val1", "key2": "val2"} if some_var == "" else { "key": "val" } | ||
)] | ||
items = [ | ||
{"key1": "val1", "key2": "val2"} if some_var == "longstring" else { "key": "val" } | ||
] | ||
items = [ | ||
({"key1": "val1", "key2": "val2"} if some_var == "longstring" else { "key": "val" }) | ||
] | ||
items = [({"key1": "val1", "key2": "val2"} if some_var == "" else { "key": "val" })] | ||
items = [{"key1": "val1", "key2": "val2"} if some_var == "" else { "key": "val" }] | ||
|
||
items = [ | ||
( | ||
"123456890123457890123468901234567890" | ||
if some_var == "longstrings" | ||
else "123467890123467890" | ||
) | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
and some_var == "longstring" | ||
and {"key": "val"} | ||
] | ||
items = [ | ||
( | ||
"123456890123457890123468901234567890" | ||
and some_var == "longstrings" | ||
and "123467890123467890" | ||
) | ||
] | ||
items = [( | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
and some_var == "longstring" | ||
and {"key": "val"} | ||
)] | ||
|
||
|
||
items = [ | ||
( | ||
long_variable_name | ||
and even_longer_variable_name | ||
and yet_another_very_long_variable_name | ||
) | ||
] | ||
|
||
items = [ | ||
( | ||
long_variable_name | ||
and even_longer_variable_name | ||
and yet_another_very_long_variable_name | ||
), | ||
] | ||
|
||
|
||
# output | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else {"key": "val"} | ||
] | ||
items = [ | ||
( | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else {"key": "val"} | ||
), | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else {"key": "val"} | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
if some_var == "longstring" | ||
else {"key": "val"} | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2"} if some_var == "longstring" else {"key": "val"} | ||
] | ||
items = [{"key1": "val1", "key2": "val2"} if some_var == "" else {"key": "val"}] | ||
items = [ | ||
{"key1": "val1", "key2": "val2"} if some_var == "longstring" else {"key": "val"} | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2"} if some_var == "longstring" else {"key": "val"} | ||
] | ||
items = [{"key1": "val1", "key2": "val2"} if some_var == "" else {"key": "val"}] | ||
items = [{"key1": "val1", "key2": "val2"} if some_var == "" else {"key": "val"}] | ||
|
||
items = [ | ||
"123456890123457890123468901234567890" | ||
if some_var == "longstrings" | ||
else "123467890123467890" | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
and some_var == "longstring" | ||
and {"key": "val"} | ||
] | ||
items = [ | ||
"123456890123457890123468901234567890" | ||
and some_var == "longstrings" | ||
and "123467890123467890" | ||
] | ||
items = [ | ||
{"key1": "val1", "key2": "val2", "key3": "val3"} | ||
and some_var == "longstring" | ||
and {"key": "val"} | ||
] | ||
|
||
|
||
items = [ | ||
long_variable_name | ||
and even_longer_variable_name | ||
and yet_another_very_long_variable_name | ||
] | ||
|
||
items = [ | ||
( | ||
long_variable_name | ||
and even_longer_variable_name | ||
and yet_another_very_long_variable_name | ||
), | ||
] |