Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3dabe2c

Browse files
committedApr 13, 2013
Add diff to error messages from treewalker tests.
I've spent too long straining to see subtle difference. This helps.
1 parent 459ba5f commit 3dabe2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎html5lib/tests/test_treewalkers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import unittest
66
import warnings
7+
from difflib import unified_diff
78

89
try:
910
unittest.TestCase.assertEqual
@@ -280,10 +281,14 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass):
280281
output = convertTokens(treeClass["walker"](document))
281282
output = attrlist.sub(sortattrs, output)
282283
expected = attrlist.sub(sortattrs, convertExpected(expected))
284+
diff = "".join(unified_diff([line + "\n" for line in expected.splitlines()],
285+
[line + "\n" for line in output.splitlines()],
286+
"Expected", "Received"))
283287
assert expected == output, "\n".join([
284288
"", "Input:", input,
285289
"", "Expected:", expected,
286-
"", "Received:", output
290+
"", "Received:", output,
291+
"", "Diff:", diff,
287292
])
288293
except NotImplementedError:
289294
pass # Amnesty for those that confess...

0 commit comments

Comments
 (0)
Please sign in to comment.