8000 A bit more test infrastructure related to the previous ci · peteyan/html5lib-python@09a26b9 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 09a26b9

Browse files
committed
A bit more test infrastructure related to the previous ci
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401170
1 parent bb16218 commit 09a26b9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_encoding.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
import re, unittest
88

9-
class Html5EncodingTestCase(unittest.TestCase): pass
9+
class Html5EncodingTestCase(unittest.TestCase):
10+
def test_codec_name(self):
11+
self.assertEquals(inputstream.codecName("utf-8"), "utf-8")
12+
self.assertEquals(inputstream.codecName("utf8"), "utf-8")
13+
self.assertEquals(inputstream.codecName(" utf8 "), "utf-8")
14+
self.assertEquals(inputstream.codecName("ISO_8859--1"), "windows-1252")
1015

1116
def buildTestSuite():
1217
for filename in html5lib_test_files("encoding"):
@@ -16,7 +21,9 @@ def buildTestSuite():
1621
for idx, test in enumerate(tests):
1722
def encodingTest(self, data=test['data'], encoding=test['encoding']):
1823
stream = inputstream.HTMLInputStream(data,chardet=False)
19-
self.assertEquals(encoding.lower(), stream.charEncoding[0])
24+
errorMessage = "Input:\n%s\nExpected:\n%s\nRecieved\n%s\n"%(data, encoding.lower(),
25+
stream.charEncoding[0])
26+
self.assertEquals(encoding.lower(), stream.charEncoding[0], errorMessage)
2027
setattr(Html5EncodingTestCase, 'test_%s_%d' % (test_name, idx+1),
2128
encodingTest)
2229

@@ -29,6 +36,7 @@ def test_chardet(self):
2936
setattr(Html5EncodingTestCase, 'test_chardet', test_chardet)
3037
except ImportError:
3138
print "chardet not found, skipping chardet tests"
39+
3240

3341
return unittest.defaultTestLoader.loadTestsFromName(__name__)
3442

0 commit comments

Comments
 (0)
0