Skip to content

Commit a9896a6

Browse files
author
y-p
committed
TST: test series to_csv() with unicode index
1 parent 6a197ce commit a9896a6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pandas/tests/test_series.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,12 +2033,16 @@ def test_to_csv(self):
20332033

20342034
os.remove('_foo')
20352035

2036-
def test_to_csv_stringio(self):
2037-
buf = StringIO()
2038-
self.ts.to_csv(buf, index=False)
2036+
def test_to_csv_unicode_index(self):
2037+
buf=StringIO()
2038+
s=Series([u"\u05d0","d2"], index=[u"\u05d0",u"\u05d1"])
2039+
2040+
s.to_csv(buf, encoding='UTF-8')
20392041
buf.seek(0)
2040-
arr = np.loadtxt(buf)
2041-
assert_almost_equal(arr, self.ts.values)
2042+
2043+
s2 = Series.from_csv(buf, index_col=0, encoding='UTF-8')
2044+
2045+
assert_series_equal(s, s2)
20422046

20432047
def test_to_dict(self):
20442048
self.assert_(np.array_equal(Series(self.ts.to_dict()), self.ts))

0 commit comments

Comments
 (0)