8000 Small (very small) improvements when tested with multiple alternate e… · awesome-python/html5lib-python@dc590a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc590a6

Browse files
committed
Small (very small) improvements when tested with multiple alternate expected output (no longer relies on assertEquals and an AssertionError being raised; now makes comparison with == and eventually call fail() with a sensible error message)
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40628
1 parent 63fd6f7 commit dc590a6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/test_serializer.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ def mockTest(self, expected, input, options):
4545
exception = None
4646
result = self.serialize_html(input, options)
4747
for alternative in expected:
48-
try:
49-
self.assertEquals(alternative, result)
50-
except AssertionError:
51-
pass
52-
else:
48+
if alternative == result:
5349
break
5450
else:
55-
options["omit_optional_tags"] = False
56-
self.assertEquals(self.serialize_html(input, options), result)
51+
if options.get("omit_optional_tags", True):
52+
options["omit_optional_tags"] = False
53+
self.assertEquals(self.serialize_html(input, options), result)
54+
else:
55+
self.fail("Expected: %s, Received: %s" % (expected, result))
5756

5857
def serialize_html(self, input, options):
5958
return u''.join(serializer.HTMLSerializer( \

0 commit comments

Comments
 (0)
0