summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ftplib.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2017-07-22 17:20:22 (GMT)
committerGiampaolo Rodola <g.rodola@gmail.com>2017-07-22 17:20:22 (GMT)
commit2b1e6e9696cb433c0e0da11145157d54275d119f (patch)
tree4ded3efdf0d63a9de76044c94c1aa63a2a51bce3 /Lib/test/test_ftplib.py
parent896145d9d266ee2758cfcd7691238cbc1f9e1ab8 (diff)
downloadcpython-2b1e6e9696cb433c0e0da11145157d54275d119f.zip
cpython-2b1e6e9696cb433c0e0da11145157d54275d119f.tar.gz
cpython-2b1e6e9696cb433c0e0da11145157d54275d119f.tar.bz2
bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214)
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 6571816..24ea382 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -485,6 +485,9 @@ class TestFTPClass(TestCase):
self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****'))
def test_exceptions(self):
+ self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r\n0')
+ self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\n0')
+ self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r0')
self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400')
self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499')
self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500')
@@ -493,7 +496,8 @@ class TestFTPClass(TestCase):
def test_all_errors(self):
exceptions = (ftplib.error_reply, ftplib.error_temp, ftplib.error_perm,
- ftplib.error_proto, ftplib.Error, OSError, EOFError)
+ ftplib.error_proto, ftplib.Error, OSError,
+ EOFError)
for x in exceptions:
try:
raise x('exception not included in all_errors set')