diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-02-27 11:38:27 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-02-27 11:38:27 (GMT) |
commit | e36b2c693cdb8d1bf1900be41bc808da9eb53e17 (patch) | |
tree | 4df740ac93dcdd10f1426780db911acba349709e /Lib/test/test_codecs.py | |
parent | 8a0212eef8ab3cd98929677deaed7adc1734ea42 (diff) | |
download | cpython-e36b2c693cdb8d1bf1900be41bc808da9eb53e17.zip cpython-e36b2c693cdb8d1bf1900be41bc808da9eb53e17.tar.gz cpython-e36b2c693cdb8d1bf1900be41bc808da9eb53e17.tar.bz2 |
Recorded merge of revisions 78462,78484 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r78462 | florent.xicluna | 2010-02-26 12:12:33 +0100 (ven, 26 fév 2010) | 9 lines
Merged revisions 78461 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78461 | florent.xicluna | 2010-02-26 11:40:58 +0100 (ven, 26 fév 2010) | 2 lines
#691291: codecs.open() should not convert end of lines on reading and writing.
........
................
r78484 | florent.xicluna | 2010-02-27 12:31:21 +0100 (sam, 27 fév 2010) | 9 lines
Merged revisions 78482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78482 | florent.xicluna | 2010-02-27 12:19:18 +0100 (sam, 27 fév 2010) | 2 lines
Add entry for issue #691291.
........
................
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index d0bcf56..2c646ba 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -483,6 +483,21 @@ class UTF16Test(ReadTest): self.check_state_handling_decode(self.encoding, "spamspam", self.spambe) + def test_bug691291(self): + # Files are always opened in binary mode, even if no binary mode was + # specified. This means that no automatic conversion of '\n' is done + # on reading and writing. + s1 = 'Hello\r\nworld\r\n' + + s = s1.encode(self.encoding) + try: + with open(support.TESTFN, 'wb') as fp: + fp.write(s) + with codecs.open(support.TESTFN, 'U', encoding=self.encoding) as reader: + self.assertEqual(reader.read(), s1) + finally: + support.unlink(support.TESTFN) + class UTF16LETest(ReadTest): encoding = "utf-16-le" |