Avoid line break before for in comprehension if outer expression expands (#5912)

This commit is contained in:
Micha Reiser 2023-07-20 12:07:22 +02:00 committed by GitHub
parent c2b7b46717
commit eeb8a5fe0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 107 additions and 12 deletions

View file

@ -74,4 +74,15 @@
a, # Trailing
) in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension # Trailing
} # Trailing
# Trailing
# Trailing
# Regression tests for https://github.com/astral-sh/ruff/issues/5911
selected_choices = {
k: str(v) for v in value if str(v) not in self.choices.field.empty_values
}
selected_choices = {
k: str(v)
for vvvvvvvvvvvvvvvvvvvvvvv in value if str(v) not in self.choices.field.empty_values
}

View file

@ -43,3 +43,13 @@
if
gggggggggggggggggggggggggggggggggggggggggggg
]
# Regression tests for https://github.com/astral-sh/ruff/issues/5911
selected_choices = [
str(v) for v in value if str(v) not in self.choices.field.empty_values
]
selected_choices = [
str(v)
for vvvvvvvvvvvvvvvvvvvvvvv in value if str(v) not in self.choices.field.empty_values
]

View file

@ -43,3 +43,13 @@
if
gggggggggggggggggggggggggggggggggggggggggggg
}
# Regression tests for https://github.com/astral-sh/ruff/issues/5911
selected_choices = {
str(v) for v in value if str(v) not in self.choices.field.empty_values
}
selected_choices = {
str(v)
for vvvvvvvvvvvvvvvvvvvvvvv in value if str(v) not in self.choices.field.empty_values
}