Skip to content

Commit 0c1de9f

Browse files
committed
TST: add test for read_csv with unicode bug
see pandas-dev#13549
1 parent ab153d5 commit 0c1de9f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/io/tests/parser/common.py

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import re
99
import sys
1010
from datetime import datetime
11+
from io import BytesIO
1112

1213
import nose
1314
import numpy as np
@@ -1583,3 +1584,13 @@ def test_temporary_file(self):
15831584
new_file.close()
15841585
expected = DataFrame([[0, 0]])
15851586
tm.assert_frame_equal(result, expected)
1587+
1588+
def test_read_csv_utf_aliases(self):
1589+
# see gh issue 13549
1590+
expected = pd.DataFrame({'mb_num': [4.8], 'multibyte': ['test']})
1591+
for byte in [8, 16]:
1592+
for fmt in ['utf-{0}', 'utf_{0}', 'UTF-{0}', 'UTF_{0}']:
1593+
encoding = fmt.format(byte)
1594+
data = 'mb_num,multibyte\n4.8,test'.encode(encoding)
1595+
result = self.read_csv(BytesIO(data), encoding=encoding)
1596+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)