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

Commitb72b001

Browse files
committed
Fix#19: ResourceWarning on test_encoding (test_big5.txt unclosed)
1 parent52f9ca6 commitb72b001

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎html5lib/tests/test_encoding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def test_encoding():
5454
try:
5555
importchardet
5656
deftest_chardet():
57-
data=open(os.path.join(test_dir,"encoding" ,"chardet","test_big5.txt"),"rb").read()
58-
encoding=inputstream.HTMLInputStream(data).charEncoding
59-
assertencoding[0].lower()=="big5"
57+
withopen(os.path.join(test_dir,"encoding" ,"chardet","test_big5.txt"),"rb")asfp:
58+
encoding=inputstream.HTMLInputStream(fp.read()).charEncoding
59+
assertencoding[0].lower()=="big5"
6060
exceptImportError:
6161
print("chardet not found, skipping chardet tests")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp