gh-132054: Add application/yaml to mimetypes#132056
Conversation
Misc/NEWS.d/next/Library/2025-04-03-20-28-54.gh-issue-132054.c1nlOx.rst
Outdated
Show resolved
Hide resolved
application/yaml to mimetypesapplication/yaml to mimetypes
|
@Kristinita I think you accidentally included some unrelated changes in your last push |
|
Type: Reply 💬 @brianschubert, I’m sorry, I made a mistake in the test file and create the new commit that fix tests. I can’t push my changes to GitHub, so I run I can close this pull request, update my CPython fork and send a new pull request. Or should I do something else? I can’t find instructions for this case in Python Developer’s Guide. I apologize for the concern. Thanks. |
|
No worries! And no need to open a new PR. You can undo the extra changes by running |
|
@Kristinita please read our AI policy. A |
…mand python#132056 (comment) Signed-off-by: Kristinita <[email protected]>
|
Type: Fixed ✔️ @brianschubert , done. All checks have passed now. Thanks. |
|
Please could you add it to What's New? https://docs.python.org/3.14/whatsnew/3.14.html#mimetypes And add a test for .yml? |
|
Type: Question ❓ 1. Question
@hugovk, what is the preferred format for tests for non-preferred extensions like 2. Missing testsCurrently, the file
3. Existing test for non-preferred extensionsShould I create a test like the test for the cpython/Lib/test/test_mimetypes.py Lines 177 to 179 in ef17252 4. Simpler adding testsPossibly, it would be nice if adding tests for non-preferred extension will be simpler. For example, the file ("application/yaml", ".yml"),
("audio/mpeg", ".mp2"),
("video/mpeg", ".m1v"),
("video/mpeg", ".mpa"),
("video/mpeg", ".mpe"),
("video/mpeg", ".mpg")Thanks. |
|
We could add some a test case to check the output of def test_guess_file_type(self):
def check_file_type():
for mime_type, ext in (
("application/yaml", ".yaml"),
("application/yaml", ".yml"),
):
with self.subTest(mime_type=mime_type, ext=ext):
result, _ = mimetypes.guess_file_type(f"filename{ext}")
self.assertEqual(result, mime_type)
check_file_type()
mimetypes.init()
check_file_type()No need to exhaustively fill lots of other preferred+optional extensions, but we could include a few more, such as the |
hugovk
left a comment
There was a problem hiding this comment.
Updated to add tests and a What's New entry.
The What's New for mimetypes is getting a bit sprawling, but we can copyedit that later as part of #123299.
@Kristinita Thank you and congratulations on your first contribution to CPython!
Doc/whatsnew/3.14.rst
Outdated
| (Contributed by Hugo van Kemenade in :gh:`129965`.) | ||
|
|
||
| * Add :rfc:`9512` ``application/yaml`` MIME type for YAML files (``.yaml`` | ||
| and ``.yml``). (Contributed by Kristinita in :gh:`132056`.) |
There was a problem hiding this comment.
@Kristinita We can put your full name here if you like.
There was a problem hiding this comment.
@hugovk, thanks for adding the function test_guess_file_type()!
My contribution here is insignificant, and I think it would be more fair if you will add your name instead of my.
(But if the name of the author of the pull request is required, perhaps, Sasha “Nelie” Chernykh instead of Kristinita would be better).
Thanks.
There was a problem hiding this comment.
You contribution is not insignificant. I've put both our names there, thanks again!
application/yamltomimetypes#132054