-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Regression with master #1044
Comments
Bisecting points to 957ba24 from PR #850 to fix #548:
|
And here's one problematic snippet from the source file: class TestLinkCollector(object):
def test_collect_links(self):
assert actual_page_links[0].url == (
"https://pypi.org/abc-1.0.tar.gz#md5=000000000"
) And the log: --- source
+++ first pass
@@ -1,7 +1,6 @@
class TestLinkCollector(object):
def test_collect_links(self):
- assert actual_page_links[0].url == (
- "https://pypi.org/abc-1.0.tar.gz#md5=000000000"
- )
+ assert actual_page_links[
+ 0
+ ].url == "https://pypi.org/abc-1.0.tar.gz#md5=000000000"
-
--- first pass
+++ second pass
@@ -1,6 +1,6 @@
class TestLinkCollector(object):
def test_collect_links(self):
- assert actual_page_links[
- 0
- ].url == "https://pypi.org/abc-1.0.tar.gz#md5=000000000"
+ assert (
+ actual_page_links[0].url == "https://pypi.org/abc-1.0.tar.gz#md5=000000000"
+ )
In this case, the second pass would be stable and Black won't change it again. |
And that snippet is the only bit in the input file that Black tripped over: manually fixing that bit meant the rest of the file (and codebase) could be formatted fine. |
Fixes #1042 (and probably #1044 which looks like the same thing). The issue with the "obviously unnecessary" parentheses that #850 removed is that sometimes they're necessary to help Black fit something in one line. I didn't see an obvious solution that still removes the parens #850 was intended to remove, so let's back out this change for now in the interest of unblocking a release. This PR also adds a test adapted from the failing example in #1042, so that if we try to reapply the #850 change we don't break the same case again.
It works now with latest master on 14b28c8:
The whole codebase formats with no errors. Thanks! |
Thanks for checking! |
Fixes psf#1042 (and probably psf#1044 which looks like the same thing). The issue with the "obviously unnecessary" parentheses that psf#850 removed is that sometimes they're necessary to help Black fit something in one line. I didn't see an obvious solution that still removes the parens psf#850 was intended to remove, so let's back out this change for now in the interest of unblocking a release. This PR also adds a test adapted from the failing example in psf#1042, so that if we try to reapply the psf#850 change we don't break the same case again.
Operating system: macOS Mojave 10.14.6
Python version: 3.7.4
Black version: master
Possibly duplicates of #1041 and #1042.
Running Black master on the pip master codebase, all reformat except one:
The source file:
https://github.com/pypa/pip/blob/e6f69fadd8c84526d933b2650141193595059e72/tests/unit/test_collector.py
The Black log file:
The text was updated successfully, but these errors were encountered: