diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-04-02 20:13:27 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-04-02 20:13:27 (GMT) |
commit | ed3a303548ba08aac44176b4566efa2f3bc0db66 (patch) | |
tree | 90cfec9f3e003b6b3a01a975004e50aa4bd77c5d /Lib/test/test_ftplib.py | |
parent | 6395241471fb21a308d1d3595de7e704de0b97ae (diff) | |
download | cpython-ed3a303548ba08aac44176b4566efa2f3bc0db66.zip cpython-ed3a303548ba08aac44176b4566efa2f3bc0db66.tar.gz cpython-ed3a303548ba08aac44176b4566efa2f3bc0db66.tar.bz2 |
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)
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r-- | 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 index 824b7c1..6a65165 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -588,6 +588,10 @@ class TestFTPClass(TestCase): 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]) |