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

Merge from upstream #1

Merged
merged 1 commit into from Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions black.py
Expand Up @@ -3876,8 +3876,8 @@ def diff(a: str, b: str, a_name: str, b_name: str) -> str:
"""Return a unified diff string between strings `a` and `b`."""
import difflib

a_lines = [line + "\n" for line in a.split("\n")]
b_lines = [line + "\n" for line in b.split("\n")]
a_lines = [line + "\n" for line in a.splitlines()]
b_lines = [line + "\n" for line in b.splitlines()]
return "".join(
difflib.unified_diff(a_lines, b_lines, fromfile=a_name, tofile=b_name, n=5)
)
Expand Down
5 changes: 2 additions & 3 deletions tests/data/blackd_diff.diff
@@ -1,6 +1,6 @@
--- [Deterministic header]
+++ [Deterministic header]
@@ -1,7 +1,6 @@
@@ -1,6 +1,5 @@
-def abc ():
- return ["hello", "world",
- "!"]
Expand All @@ -9,6 +9,5 @@

-print( "Incorrect formatting"
-)
+
+print("Incorrect formatting")
+
3 changes: 1 addition & 2 deletions tests/data/expression.diff
Expand Up @@ -160,7 +160,7 @@
slice[0:1:2]
slice[:]
slice[:-1]
@@ -134,113 +169,171 @@
@@ -134,112 +169,170 @@
numpy[-(c + 1) :, d]
numpy[:, l[-2]]
numpy[:, ::-1]
Expand Down Expand Up @@ -404,4 +404,3 @@
return True
last_call()
# standalone comment at ENDMARKER