Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting for if clauses in match-case blocks #4269

Merged
merged 8 commits into from
Mar 16, 2024

Conversation

rdrll
Copy link
Contributor

@rdrll rdrll commented Mar 9, 2024

Description

Fixes #3793.

Now the if clauses in the case-match blocks will be correctly wrapped with parenthesis.

The previous problem of having redundant parentheses being added to case statement when it's accompanied by an if clause that was too long, like the example mentioned in #3793 discussion, is also resolved.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

Copy link

github-actions bot commented Mar 9, 2024

diff-shades reports zero changes comparing this PR (c87416a) to main (8332a75).


What is this? | Workflow run | diff-shades documentation

@JelleZijlstra JelleZijlstra self-requested a review March 9, 2024 02:49
src/black/linegen.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

docs/the_black_code_style/future_style.md Outdated Show resolved Hide resolved
src/black/linegen.py Outdated Show resolved Hide resolved
tests/data/cases/pattern_matching_with_if_stmt.py Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

if clauses in match-case blocks aren't reformatted to fit the line width limit
2 participants