Skip to content

Commit 41202a2

Browse files
committed
Add more tests
1 parent 9b19919 commit 41202a2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_csv.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,17 @@ def test_writerows_with_none(self):
231231
self.assertEqual(fileobj.read(), 'a\r\n""\r\n')
232232

233233
def test_writerows_with_bytes(self):
234-
with TemporaryFile("w+", newline='', encoding='iso-8859-1') as fileobj:
234+
with TemporaryFile("w+", newline='', encoding='latin-1') as fileobj:
235235
writer = csv.writer(fileobj)
236236
writer.writerows([['a', b'\xc2'], [b'\xc2', 'c']])
237237
fileobj.seek(0);
238238
self.assertEqual(fileobj.read(), 'a,\xc2\r\n\xc2,c\r\n')
239239

240+
with TemporaryFile("w+", newline='', encoding='utf-8') as fileobj:
241+
writer = csv.writer(fileobj)
242+
self.assertRaises(UnicodeDecodeError, writer.writerows, [['a', b'\xc2'], ['a', 'c']])
243+
244+
240245
@support.cpython_only
241246
def test_writerows_legacy_strings(self):
242247
import _testcapi

0 commit comments

Comments
 (0)