-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-136507: Fix mimetypes CLI to handle multiple file parameters #136508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Supplement: #136507 (comment) , so this only in 3.14 and 3.15. CC: @hugovk could you review this? |
It's probably a good idea to add both success and failure test case for the multiple provided values (e.g., |
Could you also test the failure case? |
Misc/NEWS.d/next/Library/2025-07-10-21-02-43.gh-issue-136507.pnEuGS.rst
Outdated
Show resolved
Hide resolved
Sorry, I might not have understood it well. 9500cb3 Run this test was failing before the fix, now it runs pass after the fix |
…nEuGS.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Lib/mimetypes.py
Outdated
results.append(f"type: {guess} encoding: {encoding}") | ||
else: | ||
sys.exit(f"error: media type unknown for {gtype}") | ||
return '\n'.join(results) | ||
return help_text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is return help_text
line used?
Either:
- delete
return help_text
(that branch of the code is never used) - change
return help_text
toreturn "\n".join(results)
and delete the otherreturn
calls at the end of eachfor type in args.type
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used, IDE already given a hint
In addition, test failure case have been added
I believe there needs to be a test for the Note that this appears to be slightly changing the interface from a streaming model to a fail fast on the first error case. |
Uh oh!
There was an error while loading. Please reload this page.