mirror of https://github.com/python/cpython
(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)
This commit is contained in:
commit
4489e927a6
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue