From b41e008edb4b5c54efedb029c96b16c66446a0d3 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 8 Apr 2025 13:40:41 +0300 Subject: [PATCH] [3.12] gh-101137: Add `text/x-rst` to `mimetypes` (GH-118593) (GH-118599) --- Lib/mimetypes.py | 1 + Lib/test/test_mimetypes.py | 1 + .../next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst | 1 + 3 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 64b550b06901..814b3f9c9f9e 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -567,6 +567,7 @@ def _default_mime_types(): '.tsv' : 'text/tab-separated-values', '.vtt' : 'text/vtt', '.py' : 'text/x-python', + '.rst' : 'text/x-rst', '.etx' : 'text/x-setext', '.sgm' : 'text/x-sgml', '.sgml' : 'text/x-sgml', diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 90b983aec1b2..c366698b21b4 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -221,6 +221,7 @@ class MimeTypesTestCase(unittest.TestCase): self.assertEqual(mimetypes.guess_extension('message/rfc822'), '.eml') self.assertEqual(mimetypes.guess_extension('text/html'), '.html') self.assertEqual(mimetypes.guess_extension('text/plain'), '.txt') + self.assertEqual(mimetypes.guess_extension('text/x-rst'), '.rst') self.assertEqual(mimetypes.guess_extension('video/mpeg'), '.mpeg') self.assertEqual(mimetypes.guess_extension('video/quicktime'), '.mov') diff --git a/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst new file mode 100644 index 000000000000..3df689b2f038 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst @@ -0,0 +1 @@ +Mime type ``text/x-rst`` is now supported by :mod:`mimetypes`. -- 2.47.3