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

Commit5a2ff1e

Browse files
committed
Add a better test for encoding prescan length
1 parentb5b91cc commit5a2ff1e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎html5lib/tests/test_encoding.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
fromhtml5libimportHTMLParser,inputstream
1313

1414

15+
deftest_basic_prescan_length():
16+
data="<title>Caf\u00E9</title><!--a--><meta charset='utf-8'>".encode('utf-8')
17+
pad=1024-len(data)+1
18+
data=data.replace(b"-a-",b"-"+ (b"a"*pad)+b"-")
19+
assertlen(data)==1024# Sanity
20+
stream=inputstream.HTMLBinaryInputStream(data,chardet=False)
21+
assert'utf-8'==stream.charEncoding[0].name
22+
23+
1524
defrunParserEncodingTest(data,encoding):
1625
p=HTMLParser()
1726
assertp.documentEncodingisNone

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp