Skip to content

Commit

Permalink
Fix html5lib#19: ResourceWarning on test_encoding (test_big5.txt uncl…
Browse files Browse the repository at this point in the history
…osed)
  • Loading branch information
gsnedders committed Apr 27, 2013
1 parent 52f9ca6 commit b72b001
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions html5lib/tests/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def test_encoding():
try:
import chardet
def test_chardet():
data = open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt"), "rb").read()
encoding = inputstream.HTMLInputStream(data).charEncoding
assert encoding[0].lower() == "big5"
with open(os.path.join(test_dir, "encoding" , "chardet", "test_big5.txt"), "rb") as fp:
encoding = inputstream.HTMLInputStream(fp.read()).charEncoding
assert encoding[0].lower() == "big5"
except ImportError:
print("chardet not found, skipping chardet tests")

0 comments on commit b72b001

Please sign in to comment.