diff --git a/README.md b/README.md index 2d10a86..9685172 100644 --- a/README.md +++ b/README.md @@ -518,6 +518,8 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). * generalized star expression handling, including double stars; this fixes multiplication making expressions "unsafe" for trailing commas (#132) +* fixed `--diff` not showing entire path (#130) + * fixed parsing of complex expressions after star and double stars in function parameters (#2) diff --git a/black.py b/black.py index dd2e2d1..eafc9e7 100644 --- a/black.py +++ b/black.py @@ -341,8 +341,8 @@ def format_file_in_place( with open(src, "w", encoding=src_buffer.encoding) as f: f.write(dst_contents) elif write_back == write_back.DIFF: - src_name = f"{src.name} (original)" - dst_name = f"{src.name} (formatted)" + src_name = f"{src} (original)" + dst_name = f"{src} (formatted)" diff_contents = diff(src_contents, dst_contents, src_name, dst_name) if lock: lock.acquire() diff --git a/tests/test_black.py b/tests/test_black.py index ba834c5..6f0ffa3 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -200,7 +200,7 @@ def test_expression_diff(self) -> None: self.assertTrue(ff(tmp_file, write_back=black.WriteBack.DIFF)) sys.stdout.seek(0) actual = sys.stdout.read() - actual = actual.replace(tmp_file.name, "") + actual = actual.replace(str(tmp_file), "") finally: sys.stdout = hold_stdout os.unlink(tmp_file)