]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825) (GH-115602)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 17 Feb 2024 12:54:31 +0000 (13:54 +0100)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 12:54:31 +0000 (14:54 +0200)
Since 2f3941d743481ac48628b8b2c075f2b82762050b this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1c4028cf2f0db43659e513440257eaec01)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
Doc/library/ftplib.rst
Lib/test/test_ftplib.py

index f5686780213edd988c70771a791760ea47392429..74c7bb63b8fc0a15f6e071da4bf0e406bbaa205c 100644 (file)
@@ -232,8 +232,8 @@ FTP objects
    .. method:: FTP.voidcmd(cmd)
 
       Send a simple command string to the server and handle the response.  Return
-      nothing if a response code corresponding to success (codes in the range
-      200--299) is received.  Raise :exc:`error_reply` otherwise.
+      the response string if the response code corresponds to success (codes in
+      the range 200--299).  Raise :exc:`error_reply` otherwise.
 
       .. audit-event:: ftplib.sendcmd self,cmd ftplib.FTP.voidcmd
 
index a90a53f278664fd984f3e637d5cf3b9dafd3a33f..d813ecdcd6fcace08186f3b9cb412b4e988a9876 100644 (file)
@@ -544,8 +544,8 @@ class TestFTPClass(TestCase):
         self.assertFalse(self.client.passiveserver)
 
     def test_voidcmd(self):
-        self.client.voidcmd('echo 200')
-        self.client.voidcmd('echo 299')
+        self.assertEqual(self.client.voidcmd('echo 200'), '200')
+        self.assertEqual(self.client.voidcmd('echo 299'), '299')
         self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 199')
         self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300')