We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b625f08 commit 9d5c25bCopy full SHA for 9d5c25b
pandas/tests/frame/test_to_csv.py
@@ -922,7 +922,7 @@ def test_to_csv_path_is_none(self):
922
@pytest.mark.parametrize('frame, encoding', [
923
(DataFrame([[0.123456, 0.234567, 0.567567],
924
[12.32112, 123123.2, 321321.2]],
925
- index=['A', 'B'], columns=['X', 'Y', 'Z']), 'utf-8'),
+ index=['A', 'B'], columns=['X', 'Y', 'Z']), None),
926
(DataFrame([['abc', 'def', 'ghi']], columns=['X', 'Y', 'Z']), 'ascii'),
927
(DataFrame(5 * [[123, u"你好", u"世界"]],
928
columns=['X', 'Y', 'Z']), 'gb2312'),
@@ -942,7 +942,7 @@ def test_to_csv_compression(self, frame, encoding, compression):
942
943
# explicitly make sure file is compressed
944
with tm.decompress_file(filename, compression) as fh:
945
- text = fh.read().decode(encoding)
+ text = fh.read().decode(encoding or 'utf8')
946
for col in frame.columns:
947
assert col in text
948
pandas/tests/series/test_io.py
@@ -139,7 +139,7 @@ def test_to_csv_path_is_none(self):
139
140
@pytest.mark.parametrize('s, encoding', [
141
(Series([0.123456, 0.234567, 0.567567], index=['A', 'B', 'C'],
142
- name='X'), 'utf-8'),
+ name='X'), None),
143
(Series(['abc', 'def', 'ghi'], name='X'), 'ascii'),
144
(Series(["123", u"你好", u"世界"], name=u"中文"), 'gb2312'),
145
(Series(["123", u"Γειά σου", u"Κόσμε"], name=u"Ελληνικά"), 'cp737')
@@ -158,7 +158,7 @@ def test_to_csv_compression(self, s, encoding, compression):
158
159
# explicitly ensure file was compressed
160
161
162
assert s.name in text
163
164
0 commit comments