mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825) (GH-115601)
Since2f3941d743
this function returns the response string, rather than nothing. (cherry picked from commite88ebc1c40
) Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
This commit is contained in:
parent
bf0e072980
commit
d46a2a0008
2 changed files with 4 additions and 4 deletions
|
@ -232,8 +232,8 @@ FTP objects
|
||||||
.. method:: FTP.voidcmd(cmd)
|
.. method:: FTP.voidcmd(cmd)
|
||||||
|
|
||||||
Send a simple command string to the server and handle the response. Return
|
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
|
the response string if the response code corresponds to success (codes in
|
||||||
200--299) is received. Raise :exc:`error_reply` otherwise.
|
the range 200--299). Raise :exc:`error_reply` otherwise.
|
||||||
|
|
||||||
.. audit-event:: ftplib.sendcmd self,cmd ftplib.FTP.voidcmd
|
.. audit-event:: ftplib.sendcmd self,cmd ftplib.FTP.voidcmd
|
||||||
|
|
||||||
|
|
|
@ -542,8 +542,8 @@ class TestFTPClass(TestCase):
|
||||||
self.assertFalse(self.client.passiveserver)
|
self.assertFalse(self.client.passiveserver)
|
||||||
|
|
||||||
def test_voidcmd(self):
|
def test_voidcmd(self):
|
||||||
self.client.voidcmd('echo 200')
|
self.assertEqual(self.client.voidcmd('echo 200'), '200')
|
||||||
self.client.voidcmd('echo 299')
|
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 199')
|
||||||
self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300')
|
self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue