summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_csv.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_csv.py')
-rw-r--r--Lib/test/test_csv.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
index 55796a2..96f8aa7 100644
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -197,6 +197,17 @@ class Test_Csv(unittest.TestCase):
fileobj.seek(0)
self.assertEqual(fileobj.read(), "a,b\r\nc,d\r\n")
+ @support.cpython_only
+ def test_writerows_legacy_strings(self):
+ import _testcapi
+
+ c = _testcapi.unicode_legacy_string('a')
+ with TemporaryFile("w+", 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)