You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a formatting difference depending on whether you have Python <= 3.10.15 or Python > 3.10.15 installed but with the same version of Black (currently 25.1.0).
Under 3.10.15 this gets reformatted:
matchargs:
case _ if ("test"in"testing"andTrueisTrue):
print("YAY")
to this:
matchargs:
case _ if"test"in"testing"andTrueisTrue:
print("YAY")
Under 3.10.16 this reformatting doesn't occur and the parentheses remain in place.
The two statements functionally identical so I don't see why it would be reformatted for one version of Python and not for another.
To Reproduce
For example, take this code and call black on it with Python 3.10.15 and 3.10.16 installed. The results will be different.
matchargs:
case _ if ("test"in"testing"andTrueisTrue):
print("YAY")
And run it with these arguments:
$ black file.py
Black's version: 25.1.0
OS and Python version: Linux - Python 3.10.15 and 3.10.16 yield different results
Additional context
The text was updated successfully, but these errors were encountered:
$ ~/.pyenv/versions/3.10.15/bin/python -m black --diff /tmp/issue4569.py
--- /tmp/issue4569.py 2025-01-31 01:25:45.750911+00:00
+++ /tmp/issue4569.py 2025-01-31 02:05:05.187473+00:00
@@ -1,3 +1,3 @@
match args:
- case _ if ("test" in "testing" and True is True):
+ case _ if "test" in "testing" and True is True:
print("YAY")
would reformat /tmp/issue4569.py
All done! ✨ 🍰 ✨
1 file would be reformatted.
$ ~/.pyenv/versions/3.10.16/bin/python -m black --diff /tmp/issue4569.py
--- /tmp/issue4569.py 2025-01-31 01:25:45.750911+00:00
+++ /tmp/issue4569.py 2025-01-31 02:05:12.407993+00:00
@@ -1,3 +1,3 @@
match args:
- case _ if ("test" in "testing" and True is True):
+ case _ if "test" in "testing" and True is True:
print("YAY")
would reformat /tmp/issue4569.py
All done! ✨ 🍰 ✨
1 file would be reformatted.
Describe the bug
There is a formatting difference depending on whether you have Python <= 3.10.15 or Python > 3.10.15 installed but with the same version of Black (currently 25.1.0).
Under 3.10.15 this gets reformatted:
to this:
Under 3.10.16 this reformatting doesn't occur and the parentheses remain in place.
The two statements functionally identical so I don't see why it would be reformatted for one version of Python and not for another.
To Reproduce
For example, take this code and call black on it with Python 3.10.15 and 3.10.16 installed. The results will be different.
And run it with these arguments:
Additional context
The text was updated successfully, but these errors were encountered: