Updated tests/utils.py

pull/30/head
Sheng 2018-09-18 20:56:34 +08:00
parent 85efc9e447
commit 2adcf93362
1 changed files with 5 additions and 4 deletions

View File

@ -41,10 +41,11 @@ def get_content_type(filename):
def read_file(path, encoding='utf-8'):
data = open(path, 'rb').read()
if encoding is None:
return data
return data.decode(encoding)
with open(path, 'rb') as f:
data = f.read()
if encoding is None:
return data
return data.decode(encoding)
def make_tests_data_path(filename):