diff options
| author | Stefan Krah <skrah@bytereef.org> | 2012-11-02 14:44:20 +0100 |
|---|---|---|
| committer | Stefan Krah <skrah@bytereef.org> | 2012-11-02 14:44:20 +0100 |
| commit | e6996ed5d9c3ce149a8384a625521ab5a0820ae3 (patch) | |
| tree | 3a650836587ea15ec283efa03418422da466e384 /Lib | |
| parent | ed71918d1297c9d478e497c783520d46b2bc0ee4 (diff) | |
| download | cpython-git-e6996ed5d9c3ce149a8384a625521ab5a0820ae3.tar.gz | |
Issue #16145: Support legacy strings in the _csv module.
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_csv.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 55796a204a..96f8aa7ee1 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) |
