]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825)
authorMatthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
Sat, 17 Feb 2024 11:57:51 +0000 (11:57 +0000)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 11:57:51 +0000 (11:57 +0000)
Since 2f3941d743481ac48628b8b2c075f2b82762050b this function returns the
response string, rather than nothing.

Doc/library/ftplib.rst
Lib/test/test_ftplib.py

index 9abf7974d1936db8082c2c979e7c1fd1c44309eb..8d1aae018ada121c605770032e401132b3619dcd 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 81115e9db888cf2206de2440e10cb9143094cf7e..bed0e6d973b8da340f3fe8940b3ba4894794dfea 100644 (file)
@@ -543,8 +543,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')