##// END OF EJS Templates
properly close resource
Matthias Bussonnier -
Show More
@@ -13,7 +13,8 b' def test_detect_encoding():'
13 nt.assert_equal(enc, 'iso-8859-5')
13 nt.assert_equal(enc, 'iso-8859-5')
14
14
15 def test_read_file():
15 def test_read_file():
16 read_specified_enc = io.open(nonascii_path, encoding='iso-8859-5').read()
16 with io.open(nonascii_path, encoding='iso-8859-5') as f:
17 read_specified_enc = f.read()
17 read_detected_enc = openpy.read_py_file(nonascii_path, skip_encoding_cookie=False)
18 read_detected_enc = openpy.read_py_file(nonascii_path, skip_encoding_cookie=False)
18 nt.assert_equal(read_detected_enc, read_specified_enc)
19 nt.assert_equal(read_detected_enc, read_specified_enc)
19 assert u'coding: iso-8859-5' in read_detected_enc
20 assert u'coding: iso-8859-5' in read_detected_enc
General Comments 0
You need to be logged in to leave comments. Login now