Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit09a26b9

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 parentbb16218 commit09a26b9

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
importre,unittest
88

9-
classHtml5EncodingTestCase(unittest.TestCase):pass
9+
classHtml5EncodingTestCase(unittest.TestCase):
10+
deftest_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
defbuildTestSuite():
1217
forfilenameinhtml5lib_test_files("encoding"):
@@ -16,7 +21,9 @@ def buildTestSuite():
1621
foridx,testinenumerate(tests):
1722
defencodingTest(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
exceptImportError:
3138
print"chardet not found, skipping chardet tests"
39+
3240

3341
returnunittest.defaultTestLoader.loadTestsFromName(__name__)
3442

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp