fix test_csv

This commit is contained in:
Ashwin Naren
2025-04-15 16:11:32 -07:00
parent 4336b9e787
commit a0226df166

12
Lib/test/test_csv.py vendored
View File

@@ -291,18 +291,6 @@ class Test_Csv(unittest.TestCase):
self.assertRaises(TypeError, writer.writerows, None)
self.assertRaises(OSError, writer.writerows, BadIterable())
@support.cpython_only
@support.requires_legacy_unicode_capi()
@warnings_helper.ignore_warnings(category=DeprecationWarning)
def test_writerows_legacy_strings(self):
import _testcapi
c = _testcapi.unicode_legacy_string('a')
with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
writer = csv.writer(fileobj)
writer.writerows([[c]])
fileobj.seek(0)
self.assertEqual(fileobj.read(), "a\r\n")
def _read_test(self, input, expect, **kwargs):
reader = csv.reader(input, **kwargs)
result = list(reader)