[Python-checkins] cpython (merge 3.3 -> default): (Merge 3.3) Close #6822: ftplib.FTP.storlines() expects a binary file, not a
victor.stinner
python-checkins at python.org
Tue Apr 2 22:14:04 CEST 2013
http://hg.python.org/cpython/rev/9328e2b8a397
changeset: 83065:9328e2b8a397
parent: 83063:68ed5b2ca867
parent: 83064:c78dfc6ce37a
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Apr 02 22:13:49 2013 +0200
summary:
(Merge 3.3) Close #6822: ftplib.FTP.storlines() expects a binary file, not a text file
Add an unit test to ensure that text files are rejectect (with TypeError)
files:
Lib/test/test_ftplib.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -588,6 +588,10 @@
self.client.storlines('stor foo', f, callback=lambda x: flag.append(None))
self.assertTrue(flag)
+ f = io.StringIO(RETR_DATA.replace('\r\n', '\n'))
+ # storlines() expects a binary file, not a text file
+ self.assertRaises(TypeError, self.client.storlines, 'stor foo', f)
+
def test_nlst(self):
self.client.nlst()
self.assertEqual(self.client.nlst(), NLST_DATA.split('\r\n')[:-1])
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list