diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-04-02 20:13:49 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-04-02 20:13:49 (GMT) |
commit | 4489e927a6e030f19fee77783ebb209119f4ad60 (patch) | |
tree | 9f361d65c96bde27f9a40c4a0d9dc91e272c769b /Lib/test/test_ftplib.py | |
parent | d9ebf4dc1f2a816ea708e055d544efb2e2d0a7d5 (diff) | |
parent | ed3a303548ba08aac44176b4566efa2f3bc0db66 (diff) | |
download | cpython-4489e927a6e030f19fee77783ebb209119f4ad60.zip cpython-4489e927a6e030f19fee77783ebb209119f4ad60.tar.gz cpython-4489e927a6e030f19fee77783ebb209119f4ad60.tar.bz2 |
(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)
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 2e89973..21592d7 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]) |