]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101137: Add `text/x-rst` to `mimetypes` (#118593)
authorNikita Sobolev <mail@sobolevn.me>
Sun, 5 May 2024 13:39:50 +0000 (16:39 +0300)
committerGitHub <noreply@github.com>
Sun, 5 May 2024 13:39:50 +0000 (13:39 +0000)
Lib/mimetypes.py
Lib/test/test_mimetypes.py
Misc/NEWS.d/next/Library/2024-05-05-16-08-03.gh-issue-101137.71ECXu.rst [new file with mode: 0644]

index 021ae985b40eb0aaf683ffa8a73d4d8d541cc9a2..65a049ae9945f666794ca01cb16b449ec141942c 100644 (file)
@@ -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',
index 30e1c56bf0bc52a52dc18b2aaf0923e9276baf08..bf6eae7d0ac9c673f85c0e5e36032952e2ce792c 100644 (file)
@@ -214,6 +214,7 @@ class MimeTypesTestCase(unittest.TestCase):
             self.assertEqual(mimetypes.guess_extension('text/html'), '.html')
             self.assertEqual(mimetypes.guess_extension('text/plain'), '.txt')
             self.assertEqual(mimetypes.guess_extension('text/rtf'), '.rtf')
+            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 (file)
index 0000000..3df689b
--- /dev/null
@@ -0,0 +1 @@
+Mime type ``text/x-rst`` is now supported by :mod:`mimetypes`.