Skip to content

Commit d6de5c5

Browse files
committed
fix mkexcel on windonws
1 parent 911ff8a commit d6de5c5

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/test_mkexcel.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,39 @@ class TestDumpTool(unittest.TestCase):
1313

1414
# FIXME (使用虚拟文件)
1515
def test_dumpexcel_csv(self):
16-
fin = open('./fixture/files/expand.1.json', 'r')
16+
fin = open('./fixture/files/expand.1.json', 'r', encoding='utf-8')
1717
fout = open('./fixture/files/tmp.output.1.csv', 'wb')
1818

1919
dump_excel(fin, fout, DumpCSV)
2020
fin.close()
2121
fout.close()
2222

23-
output = open('./fixture/files/output.1.csv', 'r')
24-
fout = open('./fixture/files/tmp.output.1.csv', 'r')
23+
output = open('./fixture/files/output.1.csv', 'r', encoding='utf-8')
24+
fout = open('./fixture/files/tmp.output.1.csv', 'r', encoding='utf-8')
2525

2626
self.assertEqual(output.read(), fout.read())
2727

2828
output.close()
2929
fout.close()
3030

3131
def test_dumpexcel_csv_with_sort(self):
32-
fin = open('./fixture/files/expand.1.json', 'r')
32+
fin = open('./fixture/files/expand.1.json', 'r', encoding='utf-8')
3333
fout = open('./fixture/files/tmp.output.1.sort.csv', 'wb')
3434

3535
dump_excel(fin, fout, DumpCSV, sort_type=True)
3636
fin.close()
3737
fout.close()
3838

39-
output = open('./fixture/files/output.1.sort.csv', 'r')
40-
fout = open('./fixture/files/tmp.output.1.sort.csv', 'r')
39+
output = open('./fixture/files/output.1.sort.csv', 'r', encoding='utf-8')
40+
fout = open('./fixture/files/tmp.output.1.sort.csv', 'r', encoding='utf-8')
4141

4242
self.assertEqual(output.read(), fout.read())
4343

4444
output.close()
4545
fout.close()
4646

4747
def test_dumpcexcel_xls(self):
48-
fin = open('./fixture/files/expand.1.json', 'r')
48+
fin = open('./fixture/files/expand.1.json', 'r', encoding='utf-8')
4949
fout = open('./fixture/files/tmp.output.1.xls', 'wb')
5050

5151
dump_excel(fin, fout, DumpXLS)
@@ -54,7 +54,7 @@ def test_dumpcexcel_xls(self):
5454
fout.close()
5555

5656
def test_dump_csv_with_non_ascii(self):
57-
fin = open('./fixture/files/expand.2.json', 'r')
57+
fin = open('./fixture/files/expand.2.json', 'r', encoding='utf-8')
5858
fout = open('./fixture/files/tmp.output.2.csv', 'wb')
5959

6060
dump_excel(fin, fout, DumpCSV)
@@ -63,7 +63,7 @@ def test_dump_csv_with_non_ascii(self):
6363
fout.close()
6464

6565
def test_dump_xls_with_non_ascii(self):
66-
fin = open('./fixture/files/expand.2.json', 'r')
66+
fin = open('./fixture/files/expand.2.json', 'r', encoding='utf-8')
6767
fout = open('./fixture/files/tmp.output.2.xls', 'wb')
6868

6969
dump_excel(fin, fout, DumpXLS)

0 commit comments

Comments
 (0)