Print out line diff on test failure (#2552)
It currently prints both ASTs - this also adds the line diff, making it much easier to visualize the changes as well. Not too verbose since it's only a diff.
This commit is contained in:
parent
26970742b7
commit
aedb4ff7f0
@ -9,7 +9,7 @@
|
||||
import black
|
||||
from black.debug import DebugVisitor
|
||||
from black.mode import TargetVersion
|
||||
from black.output import err, out
|
||||
from black.output import diff, err, out
|
||||
|
||||
THIS_DIR = Path(__file__).parent
|
||||
DATA_DIR = THIS_DIR / "data"
|
||||
@ -47,6 +47,9 @@ def _assert_format_equal(expected: str, actual: str) -> None:
|
||||
except Exception as ve:
|
||||
err(str(ve))
|
||||
|
||||
if actual != expected:
|
||||
out(diff(expected, actual, "expected", "actual"))
|
||||
|
||||
assert actual == expected
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user