Skip to content

Commit b72b001

Browse files
committed
Fix #19: ResourceWarning on test_encoding (test_big5.txt unclosed)
1 parent 52f9ca6 commit b72b001

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
import chardet
5656
def test_chardet():
57-
data = open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt"), "rb").read()
58-
encoding = inputstream.HTMLInputStream(data).charEncoding
59-
assert encoding[0].lower() == "big5"
57+
with open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt"), "rb") as fp:
58+
encoding = inputstream.HTMLInputStream(fp.read()).charEncoding
59+
assert encoding[0].lower() == "big5"
6060
except ImportError:
6161
print("chardet not found, skipping chardet tests")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy