8000 gh-97590: Update docs and tests for `ftplib.FTP.voidcmd` by matthewhughes934 · Pull Request #96825 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

matthewhughes934
Copy link
Contributor
@matthewhughes934 matthewhughes934 commented Sep 14, 2022

Since 2f3941d this function returns the
response string, rather than nothing. Update the docs to reflect this.
Also update tests to assert on the return value from this function.
Quick demonstration:

>>> ftp = FTP('ftp.us.debian.org')
>>> ftp.login()
'230 Login successful.'
>>> ftp.voidcmd("MDTM welcome.msg")
'213 20150513002340'

See also typeshed[1]. This fixes gh-97590

[1] https://github.com/python/typeshed/blob/3ec7b1f2bb5fb87314623c6237b1ea508d98c0a6/stdlib/ftplib.pyi#L83

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Sep 14, 2022
@ghost
Copy link
ghost commented Sep 14, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@matthewhughes934
Copy link
Contributor Author
matthewhughes934 commented Sep 14, 2022

I just noticed there are no tests asserting on the value returned from voidcmd:

$ git grep voidcmd Lib/test
Lib/test/test_ftplib.py:    def test_voidcmd(self):
Lib/test/test_ftplib.py:        self.client.voidcmd('echo 200')
Lib/test/test_ftplib.py:        self.client.voidcmd('echo 299')
Lib/test/test_ftplib.py:        self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 199')
Lib/test/test_ftplib.py:        self.assertRaises(ftplib.error_reply, self.client.voidcmd, 'echo 300')

Should there be?

EDIT: updated the tests and squashed into the commit.

@matthewhughes934 matthewhughes934 force-pushed the update-ftplib.FTP.voidcmd-docs branch 2 times, most recently from 069b067 to 516686c Compare September 17, 2022 19:38
@matthewhughes934 matthewhughes934 changed the title Update docs for ftplib.FTP.voidcmd Update docs and tests for ftplib.FTP.voidcmd Sep 17, 2022
@matthewhughes934 matthewhughes934 changed the title Update docs and tests for ftplib.FTP.voidcmd gh-97590 Update docs and tests for ftplib.FTP.voidcmd Sep 27, 2022
@matthewhughes934 matthewhughes934 force-pushed the update-ftplib.FTP.voidcmd-docs branch from 516686c to 5afd959 Compare September 27, 2022 09:12
Since 2f3941d this function returns the
response string, rather than nothing. Update the docs to reflect this.
Also update tests to assert on the return value from this function.
Quick demonstration:

    >>> ftp = FTP('ftp.us.debian.org')
    >>> ftp.login()
    '230 Login successful.'
    >>> ftp.voidcmd("MDTM welcome.msg")
    '213 20150513002340'

See also typeshed[1]. This fixes pythongh-97590

[1] https://github.com/python/typeshed/blob/3ec7b1f2bb5fb87314623c6237b1ea508d98c0a6/stdlib/ftplib.pyi#L83
@matthewhughes934 matthewhughes934 force-pushed the update-ftplib.FTP.voidcmd-docs branch from 5afd959 to 232b88d Compare September 27, 2022 09:13
@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 17, 2024
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) February 17, 2024 11:42
@serhiy-storchaka serhiy-storchaka changed the title gh-97590 Update docs and tests for ftplib.FTP.voidcmd gh-97590: Update docs and tests for ftplib.FTP.voidcmd Feb 17, 2024
@serhiy-storchaka serhiy-storchaka merged commit e88ebc1 into python:main Feb 17, 2024
@miss-islington-app
Copy link

Thanks @matthewhughes934 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 17, 2024
…nGH-96825)

Since 2f3941d this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
@bedevere-app
Copy link
bedevere-app bot commented Feb 17, 2024

GH-115601 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 17, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 17, 2024
…nGH-96825)

Since 2f3941d this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
@bedevere-app
Copy link
bedevere-app bot commented Feb 17, 2024

GH-115602 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 17, 2024
@matthewhughes934 matthewhughes934 deleted the update-ftplib.FTP.voidcmd-docs branch February 17, 2024 12:04
@matthewhughes934
Copy link
Contributor Author

Thanks @serhiy-storchaka, I completely forgot about this!

serhiy-storchaka pushed a commit that referenced this pull request Feb 17, 2024
…6825) (GH-115602)

Since 2f3941d this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
serhiy-storchaka pushed a commit that referenced this pull request Feb 17, 2024
…6825) (GH-115601)

Since 2f3941d this function returns the
response string, rather than nothing.
(cherry picked from commit e88ebc1)

Co-authored-by: Matthew Hughes <34972397+matthewhughes934@users.noreply.github.com>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
…nGH-96825)

Since 2f3941d this function returns the
response string, rather than nothing.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…nGH-96825)

Since 2f3941d this function returns the
response string, rather than nothing.
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request Jan 22, 2025
…nGH-96825)

Since 2f3941d this function returns the
response string, rather than nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ftplib.FTP.voidcmd incorrectly document the return value
3 participants
0